ある人がローンの対象となる金額と、それにかかる年数を計算する方法に関する論理式/数学を理解できません。以下の太字のテキストは、私が立ち往生している場所です。式の提案を含め、任意のアイデアをいただければ幸いです。
完全なプログラム仕様:
お客さまの年収、借入年数(借入期間)、借入金額(借入金額)、お客さまのステータス(優先はP、普通はR)を入力します。お客様が次のいずれかの条件を満たしている場合、ローンを承認します。通常のお客様の場合 - ローン金額をローン期間の月数で割った値 <= 顧客の月収の 10% まで。または、顧客が優先顧客である場合、ローン金額をローン期間の月数で割った値 <= 顧客の年収の 1%。承認または非承認を出力します。
私が理解できないこと:
ローンが不承認となった場合 (2)顧客に、現在の収入に基づくローンの最大額を伝えます(3)現在の収入でローンを承認するには、どのくらいの期間 (最も近い年に切り上げる) が必要かを伝えます。 .
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double income, preferred_validation, regular_validation, years, loan_amount, monthlyIncome, annualIncomeTest, max_amount, request_amount;
char status;
cout<<"Please enter the annual income of the customer: ";
cin>>income;
cout<<"\nPlease enter the number of years of the loan: ";
cin>>years;
cout<<"\nPlease enter the amount of the loan: ";
cin>>loan_amount;
cout<<"\nCustomer status: P - Preferred R - Regular."<<endl;
cout<<"Please enter the customer's status: ";
cin>>status;
if(status != 'P' || 'R')
{
status='R';
cout<<"\n\nThe customer status code you input does not match one of the choices.\nThe calculations that follow are based on the applicant being a Regular customer."<<endl;
}
if(status=='R')
{
regular_validation=loan_amount/(years*12);
monthlyIncome=((income/12)*.10);
if(regular_validation<=monthlyIncome)
{
cout<<"\nThis loan is approved.";
}
else
{
cout<<"\nThis loan is disapproved.";
}
}
else if(status=='P')
{
preferred_validation=loan_amount/(years*12);
annualIncomeTest=income*.01;
if(preferred_validation<=annualIncomeTest)
{
cout<<"\nThis loan is approved.";
}
else
{
cout<<"\nThis loan is disapproved."<<endl;
max_amount=???;
cout<<"As a preferred customer, the largest loan you qualify for is "<<max_amount<<" or you can get the requested amount of "<<loan_amount<<" by increasing the loan period to "<<years<<" years.";
}
}
else
{
cout<<"Restart and enter your customer status.";
}
cin.get();
cin.get();
return 0;
}