PJ 2 is to write a C+ program to compute mortgage payment for a given loan amount, annual interest rate, and number of years for the loan. Please use the following code as the framework, and you must use your name as the author. Please reference textbook page 126 - 128 (Problem-Solving Case Study: Mortgage Payment Calculator) to get the computing algorithm and some ideas about this program. Your test case #1 output must look exactly as follows including the data. You must also do test case #2 and test case #3 with different sets of data. Each test case or test run must begin with a welcome message, and must end with a thank-you message.
Here is the code I have so far. The areas with " // " are where i need help. Thank you
#include <iostream>
#include <iomanip>
using namespace std;
double loan_amount = 50000.00;
int number_of_years = 5 ;
double yearly_percent_int ;
double yearly_interest;
double monthly_interest;
int number_payments;
double getpayment(double apr)
{
double payment = 0.00 ;
yearly_percent_int = apr; // I need help with coding the payment computer here
return payment;
}
void print(double yearly_percent_int, double payment)
{
// need help here as well
}
int main()
int n = 1;
double apr1, apr2, apr3;
double pay1, pay2, pay3;
cout << "Welcome to the Mortgage Payment Tool of Dr. Simon Lin!" << endl << endl;
cout << n++ << "=====================================================." << endl << endl;
cout << ">> Enter 3 Annual % Interest Rate (such as 1.5 2.75 4.50):" << endl;
cin >> apr1 >> apr2 >> apr3 ;
cout << endl << n++ << "=====================================================." << endl;
pay1 = getpayment(apr1);
pay2 = getpayment(apr2);
pay3 = getpayment(apr3);
cout << endl;
//need help with printing two header lines here
print(apr1, pay1);
print(apr2, pay2);
print(apr3, pay3);
cout << endl;
cout << endl << n++ << "=====================================================." << endl;
cout << "Thank you for using the Mortgage Payment Tool of Dan!" << endl;
cout << n++ << "=====================================================." << endl<<endl;
cout << "To really quit the game, please enter a number: " << endl;
cin >> n ;
return 0;
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images