Results 1 to 3 of 3
  1. #1
    leoshiner is offline Member
    Join Date
    Oct 2010
    Posts
    28
    Rep Power
    0

    Default monthly mortgage payment formula

    I have written this program to calculate the monthly mortgage payment someone would have to pay but the formula I used at the end for calculating it is wrong and was wondering if anyone has the correct formula

    thanking you in advance
    Leon




    package pract16;

    import javax.swing.JOptionPane;
    import java.text.DecimalFormat;

    /**
    *
    * @author Leon
    */
    public class Pract16 {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {

    DecimalFormat twoDigits = new DecimalFormat("0.00");

    String strMoAmt,strMoTerm,strInterest;

    double moAmt,moTerm,interest,calcPayment;

    strMoAmt=JOptionPane.showInputDialog("Enter Mortgage Amount ");
    moAmt=Double.parseDouble(strMoAmt);


    strMoTerm=JOptionPane.showInputDialog("Enter Term of Mortgage ");
    moTerm=Double.parseDouble(strMoTerm);

    strInterest=JOptionPane.showInputDialog("Enter Amount of Interest ");
    interest=Double.parseDouble(strInterest);

    calcPayment=CP(moAmt,moTerm,interest);

    JOptionPane.showMessageDialog(null,"Amount of interest is "+twoDigits.format(calcPayment));






    }
    public static double CP(double x,double y,double z){

    double CP= (x*z)/(1 - Math.pow(1/(1 +z), y * 12));

    return CP;


    }

    }

  2. #2
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Posts
    339
    Rep Power
    7

    Default

    A mortgage calculation formula is not a Java problem. If you find the correct formula, we can help you if you have trouble implementing it in Java.

  3. #3
    leoshiner is offline Member
    Join Date
    Oct 2010
    Posts
    28
    Rep Power
    0

Similar Threads

  1. for online payment
    By Mayank shukla in forum New To Java
    Replies: 2
    Last Post: 04-12-2011, 10:37 AM
  2. monthly temperatures
    By droidus in forum New To Java
    Replies: 23
    Last Post: 04-05-2011, 03:21 AM
  3. Mortgage Calculator
    By rsmithjr316 in forum New To Java
    Replies: 14
    Last Post: 01-21-2011, 11:53 PM
  4. Mortgage Calculator
    By pablo2002 in forum Java Applets
    Replies: 3
    Last Post: 09-25-2010, 11:34 PM
  5. mortgage calculator help
    By kalibballer in forum New To Java
    Replies: 1
    Last Post: 03-26-2009, 12:35 PM

Posting Permissions

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