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:
The amount of the loan (principal).
The number of years for the loan to be paid off.
The annual interest rate of the loan.
The formula for determining payments is:

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:
Write a program that prompts the user for the following information:
- The amount of the loan
- The length of the loan in years
- A low interest rate in %
- A high interest rate in %
Print out the monthly payment for the different interest rates from low to high, incremented by 0.25%.
A sample run output is given below:
Mortgage problem
Principal = $100000.00
Time = 30 years
Low rate = 11%
High rate = 12%
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
Your program should make use of the built-in pow
function located in the Math
class.
Your program must make use of separate methods for the data input section and the printing section of the assignment.
Your program must use a while
loop to solve the problem.
Instructions:
Write the program. Confirm that it works to the screen using the above sample output.
Solve 2 run outputs to the printer. Use the following sets of inputs.
Run 1: Principal 187450.00
Low rate 8.00
High rate 12.00
Years 30
Run 2: Principal 12000.00
Low rate 10.00
High rate 12.00
Years 5