Java Code help Mortgage Calculator

Discussion in 'Java' started by skull, May 19, 2008.

  1. skull

    skull

    Joined:
    May 19, 2008
    Messages:
    2
    I cannot get this correct to show 3 types of loan payments.
    and to have user input to show the next 20 or so lines in DOS command prompt




    import java.lang.Math.*;
    import java.text.*;
    import java.io.*;




    public class prt1fixtry (double principle, double rate, int no_yrs)
    {
    principal = prin;
    annualInterest = rate/100; // convert rate
    years = no_yrs;
    }

    // (Main) method that will display all of the output.
    public static void main(String[] args)
    double principal = 200000.0; // same principal amount.
    {

    // Define the variables to be used
    MortgageProgram payment1 = new MortgageProgram(principal, 5.35, 7);
    MortgageProgram payment2 = new MortgageProgram(principal, 5.5, 15);
    MortgageProgram payment3 = new MortgageProgram(principal, 5.75, 30);
    payment1.print();
    payment2.print();
    payment3.print();

    // Array Size
    int size = rateArray.length - 1;

    // Correct and proper Currency Format
    DecimalFormat decimalAmount = new DecimalFormat("#,##0.00");

    // Variables used for calculating Mortgage
    System.out.println();
    System.out.println("\t\t\t\tMortgage Calculator\n");
    System.out.println("Principle: \t$" + decimalAmount.format(principle));
    System.out.println();
    System.out.println("Term\t \tRate\t\tPayment");

    for (i=size; i>=0; i--)
    {
    // Payment method, principle, terms and the interest rate array.
    payment = CalculatePayment(principle, termArray, rateArray);

    // Should display payment, rate and the amount in the current mortgage.
    System.out.println(termArray/12 + " \t\t" + 100 * rateArray + "%\t\t$" + decimalAmount.format(payment));
    }
    Systecdm.out.println();
    }

    // Used to calculate the amound in the payment based on the principle, the term and the interest rate.
    public static double CalculatePayment(double principle, int term, double rate)
    {
    //Returns the amount of the mortgage and does all the fancy work for the user behind the scenes in the meanwhile exiting quietly.
    return(principle * Math.pow(1+(rate/12), term) * rate/12) / (Math.pow(1 + rate/12, term) - 1);
    }

    }
    .

    This needs to be Java code ran in a command prompt.
     
    skull, May 19, 2008
    #1
    1. Advertising

  2. skull

    luciyahelan

    Joined:
    Nov 26, 2010
    Messages:
    8
    Buy To Let Mortgages

    I appreciate the concern which is been rose.
     
    luciyahelan, Dec 1, 2010
    #2
    1. Advertising

  3. skull

    luciyahelan

    Joined:
    Nov 26, 2010
    Messages:
    8
    I like this particular article It gives me an additional input on the information around the world Thanks a lot and keep going with posting such information.
    ======================
     
    luciyahelan, Dec 1, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lula Mcallister

    Mortgage Quotes on the Web j

    Lula Mcallister, Sep 7, 2003, in forum: Python
    Replies:
    0
    Views:
    324
    Lula Mcallister
    Sep 7, 2003
  2. f-ckf0rsake

    Mortgage refinancing, financing, stock.

    f-ckf0rsake, Sep 14, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    511
    f-ckf0rsake
    Sep 14, 2006
  3. Antony Vijayendran

    Second mortgage loans

    Antony Vijayendran, Aug 9, 2008, in forum: Python
    Replies:
    0
    Views:
    279
    Antony Vijayendran
    Aug 9, 2008
  4. Eli
    Replies:
    3
    Views:
    628
    Carstenherz
    Mar 31, 2010
  5. mark r
    Replies:
    0
    Views:
    93
    mark r
    Aug 8, 2006
Loading...

Share This Page