Mortagage Calculator
Below is one of our free research papers on Mortagage Calculator. 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.
Mortagage Calculator
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author kids
/*
Modify the mortgage program to display the mortgage payment amount.
Then, list the loan balance and interest paid for each payment over
the term of the loan. The list would scroll off the screen, but use loops to display
a partial list, hesitate, and then display more of the list. Do not use a graphical
user interface. Insert comments in the program to document the program.
*/
import java.util.Date;
import java.text.DecimalFormat;
public class mortgagecalculator
{
public static void main(String[] args)
{
Date currentDate = new Date();
//Date constructor
DecimalFormat decimalPlaces=new DecimalFormat("0.00");
//declaring variables
final double PRINCIPAL = 200000;
final double INTEREST = .0575;
final double TERM = 12*30;
//declaring variables
final double MONTHLY = (PRINCIPAL*(INTEREST/12))/(1-Math.pow (1+INTEREST/12,-TERM));
//displaying variables
System.out.println("\t\t" + currentDate);
System.out.println("\t\tPrinciple or Loan Amount: " + PRINCIPAL);
System.out.println("\t\tInterest Rate: " + INTEREST);
System.out.println("\t\tThe Term of Loan (in months): " + TERM);
System.out.println("\t\tThe Monthly Payment is: " + MONTHLY);
System.out.println(decimalPlaces.format(MONTHLY));
double balance = PRINCIPAL;
// calculate monthly interest and principal
double monthlyInterest = (balance * (INTEREST/12));
double monthlyPrincipal = (MONTHLY - monthlyInterest);
// format column headers for results to be displayed
System.out.println("\n\nPayment\tPrincipal\t\tInterest\t\tBalance");...
- Submitted by: wrivera23
- Date Submitted: 11/11/2008 03:16 PM
- Category: Technology
- Words: 284
- Pages: 2
- Views: 409
- Rank: 31821