Mortgage Calculator Jave

Below is one of our free research papers on Mortgage Calculator Jave. If the term paper below is not exactly what you're looking for, you can search our essay database for other topics or order a custom essay.

Mortgage Calculator Jave

/* Week 2 individual assignment by William Velez
Version 1.1
Edited by William Velez on September 27th, 2007
MortgageCalc.java
Write a Java program without a graphical user interface 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 this program, hard code the amount = $200,000, the term = 30 years, and the interest rate = 5.75%. Insert comments in the program to document the program.
*/

public class MortgageCalc
{
public static void main (String[] args)
{
double mortgagedAmount = 200000; //hard coded mortgaged amount
int year = 30; //years of loan
double interestRate = 5.75; //hard coded interest rate
double monthlyInterest;
double numberOfMonths;
double monthTotalPayment;
double interestPayed;
double principlePayment;
int month = 1;
//Displaying the amount mortgaged with interest rate and life of the loan in years
System.out.print("\nThe mortgage amount is: $");
System.out.println(mortgagedAmount);
System.out.print("The life of the loan in years is: ");
System.out.println(year);
System.out.print("The interest rate given is: %");
System.out.println(interestRate);

// The program will now calculate and display the mortgage payment amount
//Given the link http://www.hughchou.org/calc/formula.html which shows how to calculate mortgage amounts
//First we will calculate monthly interest

monthlyInterest = interestRate/(12*100);


//Calculate number of Months from the amount of years

numberOfMonths = year*12;

//Now to calculate monthly payment

monthTotalPayment = mortgagedAmount * (monthlyInterest / (1 - Math.pow((1 + monthlyInterest), -numberOfMonths)));

//Rounding off number which is in long form now

monthTotalPayment = Math.round(monthTotalPayment*100);...
  • Submitted by: Joersvr
  • Date Submitted: 10/31/2007 12:15 PM
  • Category: Technology
  • Words: 1154
  • Pages: 5
  • Views: 961
  • Rank: 24959

Saved Papers

Save papers so you can find them more easily!

Join Now

Get instant access to over 180,000 papers.

Join Now