1. Member
Join Date
Jun 2011
Posts
4
Rep Power
0

## mortgage calculator

I am trying to figure out what i am doing wrong. 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);

}
}

2. What do you get? Have you tried breaking up the formula into several smaller calculations.

3. Originally Posted by scooter24
double intcalc = (5.75/100.12);
What is the meaning of 100.12?

kind regards,

Jos

4. Member
Join Date
Jun 2011
Posts
4
Rep Power
0
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

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•