Calculate and display the mortgage payment amount


Assignment:

Q: Modify the below program so it will satisfy and meet below requirements:

Write the program as a procedural C++ program. Calculate and display the mortgage payment amount using the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage as input by the user. Allow the user to loop back and enter new data or quit. Insert comments in the program to document the program.

#include
#include
#include
#include

using namespace std;

float CalcMonthlyPayment(float ir, int years, float loan_amount) ;


// a procedural C++ program and using a loan amount of $200,000,
// a term of 30 years, and an interest rate of 5.75%.

int main(void)
{
float ir = (float)5.75;
int years = 30;
float loan_amount = 200000;

float monthly_payment =
CalcMonthlyPayment(ir, years, loan_amount) ;

cout << "Loan Amount: tiny_mce_markerquot; << loan_amount << endl;
cout << "Interest Rate: " << ir << "%" << endl;
cout << "Term: " << years << " years" << endl;
cout << "\n";
cout << "The monthly payment is: tiny_mce_markerquot;;
cout << CalcMonthlyPayment(ir, years, loan_amount) << endl;

getch() ;

return 0;
}

// using the equation to calculate the monthly payment
float CalcMonthlyPayment(float ir, int years, float loan_amount)
{
return loan_amount * (ir/1200)/(1-pow(1+(ir/1200),-1*(years*12)));
}

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Calculate and display the mortgage payment amount
Reference No:- TGS01937576

Now Priced at $20 (50% Discount)

Recommended (94%)

Rated (4.6/5)