Write a c++ program that will estimate the maximum affordable house payment base
ID: 3809787 • Letter: W
Question
Write a c++ program that will estimate the maximum affordable house payment based on a family's gross income and expenses:
Inputs:
Monthly Income
Total expenses
Down Payment
Output:
Maximum affordable house payment
The formula to calculate the maximum affordable monthly house payment is the lesser of 29% of your gross income or 39% of your gross income less expenses. From the input provided by the user, calculate the maximum affordable payment and display this value in another control. I suggest that you use an output only label. Your output must display the maximum affordable house payment and which percentage was used.
Explanation / Answer
#include <iostream>
using namespace std;
int main()
{
double monthlyIncome;
double totalExpenses;
double downPayment;
cout << "Enter Monthly income: ";
cin >> monthlyIncome;
cout << "Enter total expenses: ";
cin >> totalExpenses;
cout << "Enter down payment: ";
cin >> downPayment;
double grossIncomeLessExpensePart = .39* (monthlyIncome - totalExpenses);
double grossIncomePart = .29*monthlyIncome;
if (grossIncomeLessExpensePart < grossIncomePart)
{
cout << "Maximum affordable house payment: " << grossIncomeLessExpensePart << ". This is ";
cout << "39% of your gross income less expenses." << endl;
}
else
{
cout << "Maximum affordable house payment: " << grossIncomePart << ". This is ";
cout << "29% of your gross income." << endl;
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.