Very early on, computer programs were recognized for their ability to compute tedious financial and accounting records. The purpose of this assignment is to produce an amortization table for a loan. Amortization tables are used to calculate a monthly payment on a loan as well as details on each payment (principle remaining, amount to interest, amount to principle, etc.).
principle = the total amount of money left to be paid on the loan
interest rate = the monthly rate at which interest is added to the principle (divide 'annual interest rate' by 12, APR by 1200)
period = the total number of months allowed for paying off the loan
monthly payment = the minimum amount required to pay off the principle and interest per month
The function will be given the principle, interest rate, and period. The monthly payment must be calculated within this function.
To calculate the monthly payment, use the following formula:
monthlyPayment = ( interestRate + (interestRate / ( ( 1 + interestRate ) ^ period - 1 ) ) ) * principle
double principle = initial loan amount
double interestRate = monthly interest rate (yearly rate)
int period = number of months
e.g. principle = 150000, monthlyInterestRate = .06/12, period = 360 months, monthlyPayment = 899.33
Provide the monthlyPayment for the following input sets:
principle = 2500, monthlyInterestRate = .07/12, period = 180 months
principle = 1000, monthlyInterestRate = .05/12, period = 12 months
principle = 200000, monthlyInterestRate = .06/12, period = 360 months
principle = 10000, monthlyInterestRate = .18/12, period = 24 months
principle = 7500, monthlyInterestRate = .01/12, period = 40 months
Your function must return a single value of the monthly payment.
Eg. calculateMonthlyPayment( 2500, .06/12, 36 ) will return 76.05.
A calculateMonthlyPayment method that correctly returns the minimum monthly payment based on the given formula.
// include io, use std namespace
// double calculateMonthlyPayment(double, double, int);
double calculateMonthlyPayment(double myPrinciple, double myInterestRate, int myPeriod)
// return the monthly payment
cout << calculateMonthlyPayment(150000, .06/12, 360) ;