Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Background: Amortization can be defined as the paying off of debt in regular ins

ID: 3621633 • Letter: B

Question

Background:

Amortization can be defined as the paying off of debt in regular installments over a period of time. Most houses and new cars are bought using borrowed money. That money is paid off over a length of time based on an amortization schedule. A ubiquitous mathematical formula is used to compute the monthly payment given the interest rate, the amount borrowed, and the length of time over which the payments will be made (term).

Assignment:

Write a C++ program to calculate the maximum house price that the user should consider purchasing based on their yearly income and the common guide that not more than 30% of gross salary should be spent on a house payment. Ignore additional costs such as insurance, property tax, etc. and assume no down payment (100% financed).

The amortization formula is:

where:

      L = loan amount (in decimal)

      r = interest rate per year

      t = number of years for the loan (term – use 30)

      m = number of payments in a year (use 12)

      R = periodic payment

      i = r / m

An example of a program run is shown below. Your program should look and behave exactly as this example. User input is shown in red bold.

Example 1:

Please enter your yearly gross salary: 50000

Please enter an interest rate: 5.5

The target (30% of monthly salary) monthly payment range is: 1240 - 1250

Your max target house price is: 220000

with a monthly payment of: 1243.46

Press any key to continue . . .

Explanation / Answer

please rate - thanks

you weren't very specific

where does the minimum payment come from?

when do you stop, when the monthly payment is where in the rage?

what increments of principal do you use?

so I used my imagination--easy to change

#include <iostream>
#include <cmath>
using namespace std;
int main()
{double gross;
double rate,targetmin,targetmax,max,mpay=1,factor;
int month=30,principal=1,t=12;
cout<<"Please enter your yearly gross salary: ";
cin>>gross;
gross/=12.;
cout<<"Please enter an interest rate: ";
cin>>rate;
rate/=1200.;
targetmax=gross*.3;
targetmin=targetmax-10;
cout<<"The target (30% of monthly salary) monthly payment range is: "
     <<targetmin<<"-"<<targetmax<<endl;
factor=pow(1.+rate,-(month*t));
   factor=1.-factor;
   factor=rate/factor;     
while(mpay<=(targetmin+targetmax)/2.)
{mpay=factor*principal;
   principal++;
}
cout<<"Your max target house price is: "<<principal<<endl;
cout<<"with a monthly payment of: "<<mpay<<endl;
system("pause");
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote