I was hoping someone could point me in the direction of two decimal places. Thank you in advance.
/*
Week 2: Mortgage Calculator
Programmer: Tim Shannon
Date: June 11, 2007
Filename: MtgCalc.java
Purpose: This project calculates and displays
the monthly payment amount to fully
amortize a $200,000.00 loan over a 30
year term at 5.75% interest.
*/
public class MtgCalc1
{
public static void main(String[] args)
{
// Declare and build variables
int LoanAmt=200000;
int LoanTrm=360;
double Interest=.0575;
double MonthlyPmt=0;
// Display mortgage calculator
System.out.println("\t\t\tMortgage Calculator");
System.out.println("\t\t\tThe loan amount is $200,000");
System.out.println("\t\t\tThe term of the loan is 30 years");
System.out.println("\t\t\tThe interest rate is 5.75%");
System.out.println();
// Declare formula
MonthlyPmt=(LoanAmt*(Interest/12))/(1-1/Math.pow((1+Interest/12), LoanTrm));
System.out.println("\t\t\tThe monthly payment is: $"+MonthlyPmt);
System.out.println();
}
}
Pony

New Topic/Question
Reply




MultiQuote




|