Java Code help Mortgage Calculator
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
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);
// 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("Principle: \t$" + decimalAmount.format(principle));
for (i=size; i>=0; i--)
// Payment method, principle, terms and the interest rate array.
payment = CalculatePayment(principle, termArray[i], rateArray[i]);
// Should display payment, rate and the amount in the current mortgage.
System.out.println(termArray[i]/12 + " \t\t" + 100 * rateArray[i] + "%\t\t$" + decimalAmount.format(payment));
// 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.
Buy To Let Mortgages
I appreciate the concern which is been rose.
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.
|All times are GMT. The time now is 06:33 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.