//mortgageCalcV2.

cpp //Author: Drew //EDITOR: Michael Gebhardt //CT-115 D02 //This program will calclute the monthly payment //on a loan over a period of years at a certain yearly //interest rate. #include<iostream> #include<iomanip> #include<cmath> using namespace std; int main() { //data declaration double amount, y_rate, m_rate, m_pmt; int years, n_pmt; //amount: the loan amount //y_rate: yearly rate //m_rate: monthly rate //years: Number of years for the loan //n_pmt: number of payments over the years //m_pmt: mothly payment final output //data assignement cout <<"Mortgage Calculator Application"<<endl; cout <<"==============================="<<endl; cout <<"Enter the loan amount: $"; cin >>amount; cout <<"Enter the yearly interest rate (ex 10% = 10): "; cin >>y_rate; cout <<"Enter the number of years for this loan: "; cin >>years;

system("PAUSE"). //data output cout <<fixed<<setprecision(2)<<"The monthly payment = $"<<m_pmt<<endl. //ASSIGNED CODE ADDITION //outputs total amount of money spent on payments cout << fixed<<setprecision(2) << "The total value of all payments = $" << amount * (y_rate/100) * years <<endl.1). } . return 0. n_pmt) * m_rate) / (pow(m_rate + 1.//data processing m_rate = (y_rate/100) / 12. n_pmt) . n_pmt = years * 12. m_pmt = (amount * pow(m_rate + 1.

Sign up to vote on this title
UsefulNot useful