# mortgage calculator

• 06-26-2011, 01:49 PM
scooter24
mortgage calculator
I am trying to figure out what i am doing wrong.:s: I should get \$1167.15 for monthly payment but I do not. Below is my source code. Thanks in advance. :)-:

import java.text.*; // import text editor
import java.io.*; // import input/output
import java.math.*; // import math calculation

public class MortgageCalculator
{
public static void main(String[] args)
{
double interest = 5.75;
int mortgageAmount = 200000;
int years = 360;
double intcalc = (5.75/100.12);
double monthlyPayment = 0;

monthlyPayment = mortgageAmount * (intcalc/ (1-Math.pow((1+intcalc),-1* (years*12))));

System.out.println("The amount of your mortgage is " + mortgageAmount + "\n" +
" your interest rate is " + interest + "\n" + " length of mortgage is " + years +
"\n" + " and your monthly payment is " + monthlyPayment);

}
}
• 06-26-2011, 01:53 PM
sunde887
What do you get? Have you tried breaking up the formula into several smaller calculations. :(nod):
• 06-26-2011, 02:16 PM
JosAH
Quote:

Originally Posted by scooter24
double intcalc = (5.75/100.12);

What is the meaning of 100.12?

kind regards,

Jos
• 06-26-2011, 02:21 PM
scooter24
Quote:

Originally Posted by JosAH
What is the meaning of 100.12?

kind regards,

Jos

my apologies I changed it, it is suppose to be
double intcalc = (5.75/100/12);

sunde887
I get 958.3333343639343