Java Code help Mortgage Calculator

Joined
May 19, 2008
Messages
2
Reaction score
0
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.
 
Joined
Nov 26, 2010
Messages
8
Reaction score
0
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.
======================
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top