import java.text.DecimalFormat; public class Mortgage Payment Calculator { //initialize numerical values public static void main(String[] args) { //declared variables int loanamount = 200000; double MP; double Principal=200000; int[] months= new int[3]; months[0] = 84; months[1] = 180; months[2] = 360; //calculate double[] interestrate= new double[3]; interestrate[0] = .0535; interestrate[1] = .0550; interestrate[2] = .0575; DecimalFormat twoplaces = new DecimalFormat("0,000.00"); //calculate System.out.println("\tMortgage Payment Calculator\n"); //looping in progress for(int counter = 1; counter <=12; counter++); { //calculate PayMonthly = (loantotal * interestRate[i] / (1 - Math.pow(1/(1 + interestRate[i]),loanlength[i]*12))); { //calculate System.out.println("\tLoan Amount 1 = " + loanamount); System.out.println("\tYear Term is = " + yearterm[counter]); System.out.println("\tInterest Rate = " + interestrate[counter]*100); System.out.println("\tMonthly Payment is " + twoplaces.format(MP)); } } } } }

This post has been edited by **William_Wilson**: 12 June 2007 - 06:56 PM