Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Java Code help Mortgage Calculator (http://www.velocityreviews.com/forums/t615570-java-code-help-mortgage-calculator.html)

skull 05-19-2008 04:01 AM

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




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[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));
}
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.

luciyahelan 12-01-2010 03:13 AM

Buy To Let Mortgages
 
I appreciate the concern which is been rose.

luciyahelan 12-01-2010 03:14 AM

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 12:45 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.