Question: Need some help on the following problem. Write a class MortgageCalculator that extends the FinancialCalculator class. The compute method of this class prints out the

Need some help on the following problem.

Write a class MortgageCalculator that extends the FinancialCalculator class. The compute method of this class prints out the total interest paid on a mortgage. The monthly payment is computed 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 the number of payments in a year, and T is the term of the mortgage in years. The total interest paid is calculated by taking the product of the monthly payment, the number of payments in a year n, and the term 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 on calendar protected int getDaysInMonth() { return calendar.getActualMaximum(Calendar.DAY_OF_MONTH); }

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

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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!