Hey guys,so my program is supposed to calculate a mortgage monthly payment, also figure out the total amount paid. My problem is in the total payment is cutting off then cents, is there something wrong with the formulas? Ive hit a wall and any help would be appreciated.
My first post is of the function with most of the formulas, this is where it is being called.
1 2 3 4 5 6
loan_amount = valid_int("Please enter the loan anount: ");
yearly_rate = valid_int("Please enter the intrest rate: ");
num_years = valid_int("Please enter the number of years of the loan: ");
monthly_payment = calculate_mortgage(loan_amount, yearly_rate, num_years);
double total_payment = monthly_payment * num_years * 12;
cout << monthly_payment << " " << total_payment << endl;
the out put is:
Please enter the loan anount: 250000
Please enter the intrest rate: 5
Please enter the number of years of the loan: 30
The monthly payment is: 1342.05
The total amount paid is: 483139 (this should be 483139.46)