Calculation

Modify the Mortgage calculator design so that the user is able to input the mortgage principal, mortgage term, and annual interest rate. Include all the mortgage information and calculations in a separate class that is contained in a separate file. Ensure the following input values are validated:

1.Principal greater than 0 and less than 1,000,000.

2.APR greater than or equal to zero and less or equal to 100.

3.Term greater than zero.

Below is the code I need to add to

import java.io.*; //*java input output

import java.math.*; //*loan calculator

import java.text.*; //*formats numbers

//This is where you must enter class Welcome.

class Welcome {

public static void main(String[] args) {

//Define Program Variables

final double term = 360; //*360 months

final double interestRate = 0.0575; //*5.75% interest rate

final double principle = 200000; // *$200,000 Loan

final double monthlyRate = (interestRate/12);

//double payment;

//Discount factor calculator

double discountFactor = (Math.pow((1 + monthlyRate), term) -1) / (monthlyRate * Math.pow((1 + monthlyRate), term));

double payment = principle / discountFactor; //*Rate Calculation

//Output

java.text.DecimalFormat dfm = new java.text.DecimalFormat(",###.00");

System.out.println ("Your monthly payment is $" + dfm.format(payment)+" cents\n");

System.out.println ("End the Program\n");

}

}

[1507 byte] By [wraggiea] at [2007-10-2 9:49:28]
# 1
Okay.So what's your question?
Adeodatusa at 2007-7-16 23:54:42 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
Do your own homework. If you have a specific question ask it. You're just going to get flamed and insulted if you don't.
kablaira at 2007-7-16 23:54:42 > top of Java-index,Other Topics,Patterns & OO Design...