Inputs of mortgage calculator that determines a monthly payment for loans and produces an amortization schedule for the life of the loan(10-15-20) years fixed loan with 4.5% interest rate and Principal 100000$.
The program should initially prompt the user for
1) the principal of the loan. 2)It should then ask him or her to enter an annual interest rate for the loan. 3)The final input should be the number of years that the loan will be outstanding. Because the company only offers three different terms (10-, 15-, and 30-year loans),
the program should ensure that no other terms are entered.
P
= $100,000
r
= 4.50% per year / 12 months = 0.375% (or 0.00375) per period
n
= 15 years * 12 months = 180 total periods
A = 100,000 * (.00375 * (1 + .00375)180)/((1+.00375)180
– 1)
Using these numbers in the formula above yields a monthly payment of $764.99.
Amortization schedule:
The
Interest
portion of the payment is calculated as the rate (r) times the previous balance and should be rounded to the nearest cent. The
Principal
portion of the payment is calculated as
Amount - Interest. The new Balance is calculated by subtracting the
Principal
from the previous balance. The last payment amount may need to be adjusted (as in the table below) to account for the rounding.
The amortization schedule for the example above is presented here: Note that the first and last three rows are listed here so that you can see the beginning and end of the report. In your program, you must include all of the rows in your output.
- Once the inputs have been entered and validated, your program must calculate the monthly payment for the loan. you must create a
function
called
CalcPayment
that receives the principal, interest rate, and number of years as parameters. The function should
return
the monthly payment that is calculated.
- In main(), using the monthly payment that you just calculated, call a function to create an amortization schedule for the loan using these specifications:
- Create a function called
Amortize. It should receive as parameters: currentPeriod, totalPeriods, paymentAmount, monthlyInterestRate, currentBalance.
- Your program should check for invalid data such as non-numeric and non-positive entries for principal, interest rate, and term.
Therefore, you may use the following code to determine if a non-numeric or negative number has been entered:
int num;
cout < "enter="" an="" integer:="" "=""><>
cin >> num;
while (cin.fail() || num <>
{
cout < "you="" must="" enter="" a="" number,="" and="" that="" number="" must="" be="" positive. ="" please="" try="" again.="" "=""><>
cin.clear();
cin.ignore(numeric_limits::max(),'\n');
cin >> num; }
this is how the output should be:
Extracted text: Loan Application - Amortization Schedule Principal: Life of Loan (10, 15 or 30 years): Annual interest rate: Monthly payment: 100000 15 4.5% 764.99 Payment Amount Interest Principal Balance 100000.00 1 764.99 375.00 389.99 99610.01 2 764.99 373.54 391.46 99218.55 3 764.99 372.07 392.92 98825.63 178 764.99 8.54 756.45 1521.42 179 764.99 5.71 759.29 762.14 180 764.99 2.86 762.14 e.00 Press any key to continue .