I am trying to figure out agood formula for calculating MonthlyPayment, MonthlyInterestPaid, and Balance.
import java.text.DecimalFormat; //Required for format output
public class MortgagePaymentCalculator
{
//Hard code the amount=400,000, the term=30 years, and the interest rate=4.75%
static double MortgageAmount = 400000;
//400,000 is the amount of the mortgage
static int TermYears = 30;
//30 is the length of time that the amount is to be payed back
static double InterestRate = 4.75;
//4.75 is the percentage of interest to be paid monthly
static double MonthlyPayment;
//Total monthly payment
static double MonthlyInterest;
static int Months;
static double MonthlyInterestRate;
static int Payment;
static double Balance;
static double MonthlyInterestPaid;
//Main
public static void main(String[] args)
{
//Monthly Payment Calculations
Months = (TermYears * 12);
//Calculates the total number of months to pay mortgage (360)
MonthlyInterestRate = (InterestRate *.01);
//Calculates the rate to a decimal format
MonthlyInterest = (MonthlyInterestRate/12);
//Calculates the amount of monthly interest
//Calculates monthly payment
MonthlyPayment =
//Calculates the monthly payment
MonthlyInterestPaid =
//Calculates the monthly interest paid
Balance =
//Monthly Mortgage Payment Calculator Heading
DecimalFormat Money = new DecimalFormat("$0,000.00")
;
System.out.println("//////
//////////
//////////
//////////
//////////
//////////
//////////
//////////
///");
System.out.println(" Monthly Mortgage Payment Calculator");
System.out.println("//////
//////////
//////////
//////////
//////////
//////////
//////////
//////////
///");
System.out.println("------
----------
----------
----------
----------
----------
----------
----------
---");
System.out.println();
//data produced from calculations
System.out.println("Total Mortgage Financed: "+ Money.format(MortgageAmoun
t));
System.out.println();
System.out.println("Total Mortgage Term: "+ TermYears);
System.out.println();
System.out.println("Intere
st Rate: "+ InterestRate + "%");
System.out.println();
System.out.println("Monthl
y Payment At Given Interest Rate: " + Money.format(MonthlyPaymen
t));
System.out.println("------
----------
----------
----------
----------
----------
----------
----------
---");
System.out.println();
//requesting the payment amount to be calculated
System.out.println("Paymen
t #1");
System.out.println();
System.out.println("Paymen
t Amount: " + Money.format(MonthlyPaymen
t));
System.out.println("Intere
st Paid: " + Money.format(MonthlyIntere
stPaid));
System.out.println("Loan Balance: " + Money.format(Balance));
System.out.println();
System.out.println("------
----------
----------
----------
----------
----------
----------
----------
---");
System.out.println();
}//End Payment Calculations
}//End MortgagePaymentCalulator