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");
}
}

