#include #include #include using namespace std; const float BANK_PERCENT_LIMIT = 0.28; int main() { float priceOfHouse{0}, percentDown{0}, downPayment{0}, amountFinanced{0}; float interestRate{0}, years{30}, paymentsPerYear{12}; float monthlyRate{0}; float monthlyPayment{0}; float annualTaxes{0}, insurance{0}; float totalMonthlyPayment{0}; float monthlyIncome {0}, currentPayments{0}; float adjustedIncome{0}; // get the loan information. cout << "Enter the price of the house: "; cin >> priceOfHouse; cout << "Enter the percent down payment: "; cin >> percentDown; cout << endl; cout << "Enter the annual interest rate: "; cin >> interestRate; cout << "Enter the number of years: "; cin >> years; cout << "Enter the payments per year: "; cin >> paymentsPerYear; cout << endl; cout << "Enter the annual taxes: "; cin >> annualTaxes; cout << "Enter the annual insurance cost: "; cin >> insurance; cout << endl; cout << "Enter the monthly income: "; cin >> monthlyIncome; cout << "Enter the total of current monthly payments: "; cin >> currentPayments; // compute down payment downPayment = priceOfHouse * percentDown / 100.0; amountFinanced = priceOfHouse - downPayment; // compute the monhtly payment. monthlyRate = interestRate/paymentsPerYear/100.0; monthlyPayment = (amountFinanced * monthlyRate) / (1-pow(1+monthlyRate,-years*paymentsPerYear )); // compute the total monthly payment totalMonthlyPayment = monthlyPayment + annualTaxes/paymentsPerYear + insurance/paymentsPerYear; // compute the adjusted monthly income adjustedIncome = (monthlyIncome - currentPayments) * BANK_PERCENT_LIMIT; // set up the output stream cout << fixed; cout << setprecision(2); cout << endl; // print basic financing information cout << "Price of House: $" << priceOfHouse << endl; cout << "Down Payment: $" << downPayment << endl; cout << "Amount Financed: $" << amountFinanced << endl; cout << endl; // print terms of loan cout << noshowpoint; cout << "At " << interestRate << "%"; cout << setprecision(0) << " for " << years << " years." << endl; cout << "With " << paymentsPerYear << " payments per year." << endl; cout << setprecision(2) << showpoint; cout << "The monthly payment is $" << monthlyPayment << endl; cout << endl; // print the total monthly payment cout << "With annual taxes of $" << annualTaxes << endl; cout << "and yearly insurance of $" << insurance << endl; cout << "The total monthly payment is $" << totalMonthlyPayment << endl; cout << endl; // print qualification information cout << "With a monthly income of $" << monthlyIncome << endl; cout << "and payments of $" << currentPayments << endl; cout << "The adjusted monthly income is $" << adjustedIncome << endl; if (adjustedIncome > totalMonthlyPayment) { cout << "You qualify for this loan" << endl; } else { cout << "You do not qualify for this loan" << endl; } cout << endl; return 0; }