Explore BrainMass

Mortgage Calculator Separate Methods

I am not sure how to do this, attached is the program
Also I need a flowchart diagram of the program.

NO ACTIONS IN MAIN. Thus, the code The entire for loop) below should be in a separate method:

for (loan = 200000, i=0;i<terms.length;i++){
//Calculates the Payment per month to be paid under mortgage scheme One
interestRate=Rates; //take value from the array Rates[] to a temporary variable
term=terms; //take value from the array terms[] to a temporary variable
double monthlyRate = (interestRate/12); //derive the monthly interest rate
//calculate the discount factor
// MonthlyPayment = LoanAmount*Math.pow(1+MonthlyInterestRate, Period)*MonthlyInterestRate/(Math.pow(1+MonthlyInterestRate, Period) -1);

double discountFactor = (Math.pow((1 + monthlyRate), term) -1) / (monthlyRate * Math.pow((1 + monthlyRate), term));
double payment1 = loan / discountFactor; //calculate payable amount per month
//Output for mortage scheme One
System.out.println("The Loan amount is:"+df.format(loan)+"n");
System.out.println("The intrest rate is:"+interestRate*100+"%");
System.out.println("The term of the loan is:"+term/12+" years.");

//display the balance in pausable list
showBalance(term, monthlyRate, loan, payment1);


Solution Summary

The expert examines separate methods for mortgage calculators.