Mortgage Calc
807601Jan 28 2008 — edited Jan 28 2008Ok. I'm very new at java and I am having serious problems with my current class, I'm supposed to be able to write a program in Java with GUI and have it calculate and display the mortgage payment amount from the user input of the amount of the mortgage, the term of the mortgage and the interest rate of the mortgage. Allow the user to loop back and enter new data or quit.
This is what i had in the first class.
/* with a GUI . . . POS407 week 1
*
* This version calculates a $200,000 loan amount for 30 years at a rate of 5.75%
*/
import java.io.*;
import java.text.*;
import javax.swing.JOptionPane;
public class MortgageCalculator1
{
public static void main(String[] args)throws IOException
{
DecimalFormat dollarAmount = new DecimalFormat("#,###.00");
DecimalFormat percentAmount = new DecimalFormat("##.##");
// declare variables and arrays for the loan amount, term and interest rate
double loanAmount = 200000.00;
int term = 30;
double interestRate = .0575;
double payment;
payment = (loanAmount * (interestRate/12))/(1-(Math.pow(1/(1+(interestRate/12)), (term*12))));
JOptionPane.showMessageDialog( null, "Mortgage Payment on a $200,000 loan amount is $" + dollarAmount.format(payment) + " for "
+ term + " years with an interest rate of "
+ percentAmount.format((interestRate * 100)) + "%");
} // end main method
} // end MortgageCalculator1
This is probably something easy for you guys however, I'm very lost and if someone would be able to explain it (like your talking to a child) and probably help me get this on my head. Pleassssseeee! I would really appreciate any input. Thanks!