# C101 Homework #9 solved

\$35.00

## Description

5/5 - (1 vote)

1) To analyze a loan payment many things are required and the most important is the monthly
payment. Following is a sample table that shows important information for monthly payments:
Principal \$11000.00
Interest Rate 10.00%
No. of Years 4
Payments per year 12
No. of Payments 48
Monthly Payment \$278.99
Write a program which prompts the user to enter the principal, annual interest rate, the number
of years and the number of payments per year. Then using this information, calculate the
monthly payment for the loan. The formula for calculating the monthly payment is as follows:
Interest_Rate
MonthlyPayment = Principal * ——————————-
(1 – (Interest_Rate+1) -term )
Interest_Rate = annual interest rate / 12
term = years * payments per year
Use the following functions; note two are void functions one is float returning:
MonthlyPayment(Principal, Rate, Years, PaymentsPerYear)
Show_Table(Principal, Rate, Years, PaymentsPerYear)
Output should look just like above table, with same usage of \$ and % signs as well as all floats
being displayed in 2 decimal points only and no scientific notation to be displayed. Need to use
header file iomanip to do this, and look at handout “C++ output stream” for help.
Also need to use math.h header file to do part in formula that involves the exponent. Advice is
not to write out whole equation into one statement, but break it down into a few smaller
statements. And make sure when dividing you are doing float division and not integer division.
The annual interest rate when read in to program will be in form of percent, i.e. 8 for 8%, 7.75
for 7.75%, but formula must have decimal equivalent, which is 0.08 for 8% and 0.075 for 7.75%.
Make sure you take this into consideration and divide number accordingly as well.
Program should also be in a continuous loop
Main program should be relatively short. Test the program for the following input data:
(Note: below is not a table to be displayed, output should look like above example)
Principal Rate Years Period
—————————————————————- \$11,000.00 10.00% 4 12
\$15,500.00 5.70% 5 12
\$115,000.00 7.75% 30 12