# Project 05 A Mortgage Calculator solved

\$35.00

Category:

## Description

Objectives:
This project was designed to reinforce the concept of for, while, and do while statements from Chapter
5 of textbook. In this project the student will practice
1. Using an for structure.
2. Replacing an for structure with a while statement.
3. Using do while to repeat things that at least be done one time
Description of problem:
Write a mortgage calculator program to calculate fixed rate mortgage payment. Your program should
print out an amortization table on screen. For mortgage calculator and its related formula, please visit
http://en.wikipedia.org/wiki/Mortgage_calculator
The program input will be Principle, Term (in year), Quoted Interest Rate. To simplify the program, the
program output, i.e. your amortization table only need to contain the following four columns: Month,
Payment, Total Interest, and Balance. Please see the attached screen shot (page 2) for an input and
output example.
Formula used: Suppose that P is the principle, N = term * 12, and r = (Quoted Interest Rate /12) in
decimal (not percentage), then monthly payment c is
� = �� 1 + � ‘
1 + � ‘ − 1
The balance at the end of month n is
� = 1 + � *� − 1 + � * − 1 �

Total interest paid at the end of month n is:
����������������� = �� − (� − �)
You need to use the pow function in Math class. Math class belong to java.lang package. You don’t need
to import it. Here is the java expression for calculating monthly payment c:
� = � ∗ � ∗ ���ℎ. ���(1 + �, �)/(���ℎ. ��� 1 + �, � − 1)