6. Interest and Mortgage Payment
Write a program that calculates the cost of a mortgage. The program should prompt for
the initial values for the principal amount, the terms in years, and the interest rate. The
program should output the mortgage amount per month, and show the amounts paid
towards the principal amount and the monthly interest for the first three years. Determine
the principal amount after the end of the first three years.
Use the following formula to calculate the mortgage payment:
\frac{Principal \times MonthlyInterestRate}{(1 - (1/(1 + MonthlyInterestRate))^{Years \times 12})}
Monthly Payment =
Use the following input:
a) Principal Amount: $250,000 Yearly Rate: 6% Number of Years: 30
b) Principal Amount: $250,000 Yearly Rate: 7.5% Number of Years: 30
c) Principal Amount: $250,000 Yearly Rate: 6% Number of Years: 15
d) Principal Amount: $500,000 Yearly Rate: 6% Number of Years: 30