Solved

# morgage calculator

Posted on 2008-06-21

i need toi write the program in Java (without a graphical user interface) and have it calculate the payment amount for 3 mortgage loans:

- 7 year at 5.35%

- 15 year at 5.5%

- 30 year at 5.75%

Use an array for the different loans. Display the mortgage payment amount for each loan.

so far i have the following code. i am lost to the next steps i should take to create this...all help will be appreciated

code below

public class wtest

{

public static void main (String[] args)

{

double principal =2000000.0;

double rate =5.75;

double term =30.0;

double monthlyPayment =0.0;

rate = rate/1200.0;

term = term * 12;

monthlyPayment = principal * rate/ (1.0 - Math.pow(rate+1,-term));

System.out.println(monthlyPayment);

}

}[/color]

public class Wtest {

public static void main (String[] args) {

double principal = 2000000.0; // nice house!

double[] rates = { 5.35, 5.5, 5.75 };

double[] terms = { 7.0, 15.0, 30.0 };

for (int i = 0; i < rates.length; ++i) {