9-1 Lab Exercise - Loan

Background:

When buying a home, a very important financial consideration is getting a loan from a financial institution.  Interest rates can be fixed or variable and there are service charges called points for taking out a loan.  One point is equal to 1% of the loan amount borrowed.  Taking out a loan of $150,000 with a 2 point charge will cost you $3,000 before you ever make your first house payment!  Some banks offer lower interest rates but higher points, and vice versa.  It is helpful to know what the monthly house payment will be for a given loan amount over different interest rates.

The monthly payment on a loan is determined using three inputs:

1.    The amount of the loan (principal).
2.    The number of years the loan is assumed.
3.   The annual interest rate of the loan. 

The formula for determining payments is: 

a =   (p * k * c)

(c - 1)

p = principal, amount borrowed
k = monthly interest rate (annual rate/12.0)
n = number of monthly payments  (years * 12)
c = (1 + k)n
a = monthly payment (interest and principal paid)

Assignment:

1.    Write a program that prompts the user for the following information:
a.     The amount of the loan
b.    The length of the loan in years
c.     A low interest rate in %
d.    A high interest rate in %

2.    Print out the monthly payment for the different interest rates from low to high, incremented by 0.25%.

3.    A sample run output is given below:

a =   (p * k * c)

(c - 1)

 

Time = 30 years
Principal = 100000
Low Rate = 11.00 %
High Rate = 12.00 %

Annual Interest Rate                   Monthly Payment

                  11.00                                   952.32
                  11.25                                   971.26
                  11.50                                   990.29
                  11.75                                 1009.41
                  12.00                                 1028.61

4.    Your program should make use of the built-in power function located in math.h.
5.    Your program must make use of separate functions for the data input section and the printing section of the assignment.  Any data used or modified in either function must be properly passed through the parameter list.
6.    Your program must use a while loop to solve the problem.

Instructions:

1.    Write the program.  Confirm that it works to the screen using the above sample output.
2.    Solve 2 run outputs to the printer.  Use the following sets of inputs.

Run 1:                Principal                  187450.00
                         Low                                  8.00
                         High                                12.00
                         Years                              30

Run 2:                Principal                    12000.00
                         Low                                10.00
                         High                                12.00
                         Years                                5