Menu

Need Help Following Problem Write Class Mortgagecalculator Extends Financialcalculator Cla Q43787940

Need some help on the following problem.

Write a class MortgageCalculator that extends theFinancialCalculator class. The compute method of this class printsout the total interest paid on a mortgage. The monthly payment iscomputed using this formula:

Monthy payment = Axr/n divided by 1-[1/(1+r/n)nT]

where A is the mortgage amount, r is the interest rate, n is thenumber of payments in a year, and T is the term of the mortgage inyears. The total interest paid is calculated by taking the productof the monthly payment, the number of payments in a year n, and theterm T. Write a program to test this class.

The FinancialCalculator class:

package inheritance;
import java.util.*;

public abstract class FinancialCalculator {  
// calendar
protected Calendar calendar;

// returns the number of days for the current month set oncalendar
protected int getDaysInMonth() {
return calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
}

// returns the number of days in the current year set oncalendar   
protected int getDaysInYear() {
return calendar.getActualMaximum(Calendar.DAY_OF_YEAR);
}

protected abstract void getUserInput();
protected abstract void compute();
}

Expert Answer


Answer to Need some help on the following problem. Write a class MortgageCalculator that extends the FinancialCalculator class. Th…

OR