Create the mortgage calculator class
You started with a BasicCalculator that performed basic arithmetic.
You then created a FinancialCalculator which inherited from this BasicCalculator. You extended this class by adding a method, monthly_interest(), that calculates the monthly interest given the annual interest rate.
Now it's time to create the MortgageCalculator class!
Este ejercicio forma parte del curso
Case Study: Building Software in Python
Instrucciones del ejercicio
- Instantiate the parent methods and attributes without invoking the parent by name.
- Initialize
self.loan_amountusing the appropriate parameter. - Use an inherited method to initialize
self.monthly_interest_rate.
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
class MortgageCalculator(FinancialCalculator):
def __init__(self, loan_amount, annual_interest_rate, years):
# Initialize the parent attributes and functions
____
# Initialize the loan_amount attribute
self.loan_amount = ____
# Initialize the monthly_interest_rate
self.monthly_interest_rate = self.____(annual_interest_rate)