Find Us On:

# JAVA Mortgage Calculator

Seeker

1)Complete the initial requirements for Service Request SR-mf-003: Design and implement a program that calculates and displays the mortgage payment amount given the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage. In first iteration of the program, hard code the principal = \$200,000, the term = 30 years, and the annual interest rate = 5.75%. 2)Complete Change Request #1 in Service Request SR-mf-003: Modify the Mortgage Calculator design to print an Amortization Table for the provided loan. This table will include the following information: 1.Loan Balance (principal balance + interest balance) 2.Interest Paid this month 3.Total Interest Paid It should pause briefly after each screenfull of lines before continuing, to allow the user to read the data. 3)Complete Change Request #2 in Service Request SR-mf-003: Modify the Mortgage Calculator Design to calculate and display the payment amount for each of three loans: • 7 year at 5.35% • 15 year at 5.5% • 30 year at 5.75% The program does not need to print an amortization table for the loans, just the payment amount. The information about each loan (the tern and rate) should be held in an array. Complete Change Request #3 in Service Request SR-mf-003: Modify the Mortgage Calculator design to print an Amortization Table for each of the three loans. It should pause briefly after each screenfull of lines before continuing, to allow the user to read the data. Basic payment formula: To calculate the mortgage payment, use the following formula: PMT = (PV x IR) / (1 - (1 + IR)-NP) Java implementation: PMT = (PV * IR) / (1 – Math.pow(1 + IR, -NP)) Where: PMT = Monthly Payment PV = Principle Value (amount of loan) IR = Interest Rate, by month NP = Note Period, or mortgage term in months IR = APR / 100 / 12 NP = Years * 12 (for example, 5 years means NP = 60) APR = Annual Percentage Rate (for example 6.25) Use the formula above when APR > 0. If APR = 0 (an interest-free loan), then PMT = PV / NP. Amortization Table Pseudocode for the calculation process /** initialize the balances **/ loanBalance = NP * payment principalBalance = PV interestBalance = loanBalance - principalBalance totalPrincipalPaid = 0 totalInterestPaid = 0 /** step through all the payment periods */ For paymentNumber from 1 to NP: /** The portion of the payment that goes to interest is based on the remaining principal balance. **/ interestPaidThisMonth = interestRate * principalBalance /** The rest of the payment goes to principal. **/ principalPaidThisMonth = payment – interestPaidThisMonth /** Update the remaining balances and total paid values **/ loanBalance = loanBalance - payment principalBalance = principalBalance – principalPaidThisMonth totalPrincipalPaid = totalPrincipalPaid + principalPaidThisMonth interestBalance = interestBalance - interestPaidThisMonth totalInterestPaid = totalInterestPaid + interestPaidThisMonth End For Attachments
Tags Clarifications

## Mortgage Calculator

Seeker

Solution includes:
Change Request #1
Change Request #2
Change Reqeust #3

Solution in Eclipse project...
Attachments
java mortgage calculator.zip (15 K)

Preview
version="1.0" encoding="UTF-8"

Preview

Preview
<?xml version="1.0"

Preview
static void main(String [] args){ double principalValue = 200000; double apr = 5.75; // Formula for interest rate by month double interestRate = apr / 100 / 12; int term = 360; //

Preview
of 5.75% and a 30 year term. Display * the mortgage payment amount and then list the loan balance and interest paid * for each payment over the term of the loan. If the list would scroll off the * screen, use loops to display a partial

Preview
payment * over the term of the loan. Use loops to prevent lists from scrolling off the * screen. */ import java.util.Scanner; public class MortgageCalculator { // Scanner object used to receive input from the user private static Scanner scanner = new Scanner(System.in);

Screenshots