Looking for mortgage program to display 3 mortgage loans: 7 year at 5.35%, 15 year at 5.5 %, and 30 year at 5.75%. Use an array for the different loans Display the mortgage payment amount for each loan. Non-graphical user interface. Insert comments in the program to document the program.
Build on this if possible using an array:
import java.math.*;
import java.text.*;
//class BuyaHomeCalculator
class BuyaHomeCalculator {
public static void main(String arguments[]) {
//Program Variables
double term = 360;
double interestRate = 0.0575;
double loan = 200000;
double monthlyRate = (interestRate/12);
//Discount factor calculator
double discountFactor = (Math.pow((1 + monthlyRate), term) -1) / (monthlyRate * Math.pow((1 + monthlyRate), term));
double payment = loan / discountFactor;
DecimalFormat df = new DecimalFormat("$###,###.00");
//Output
System.out.println("The Loan amount is: $200,000");
System.out.println("The intrest rate is: 5.75%");
System.out.println("The term of the loan is: 30 years.");
System.out.println("Monthly Payment Amount: " + df.format(payment) );
}
}