Question: Question Python: Create a base/parent class called 'InterestCalculator'. Create a child class called 'CICalculator'. CI stands for compound interest. The 'CICalculator' class will have only
Question Python:
Create a base/parent class called 'InterestCalculator'. Create a child class called 'CICalculator'. CI stands for compound interest. The 'CICalculator' class will have only one parent, the 'InterestCalculator'. Create a child class called 'SICalculator'. The 'SI' class will have only one parent, the 'InterestCalculator'. SI stands for simple interest. The parent class needs to have an __init__ method, that will initialize all the values needed for calculating and storing interest.
The child class 'CICalculator' and 'SICalculator' must implement 'calcfinalval' method that will calculate the final value for each case.
Once all classes have been defined, the call to calculate and print the final value must follow the code below.
The arguments to the __init__ method are: (number of years, interest rate and initial principal)
c = CICalculator(2,0.1,1000) c.calcfinalval() print c.finalval
s = SICalculator(2,0.1,1000) s.calcfinalval() print s.finalval
** The answer for CICalculator is (1002.0349912). However, I found the answer (1000.0). What did I do wrong?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
