Code is copied!
A super class Bank has been defined to store the details of the customer in a bank. Define a subclass Interest to calculate the compound interest.
The details of the members of both the classes are given below:
Class name : Bank
Data members/instance variables:
name : to store the name of the customer
acc_no : integer to store the account number
principal : to store the principal amount in decimals
Methods / Member functions:
Bank( ... ) : parameterized constructor to assign values to the
data members
void display( ) : to display the customer details
Class name :Interest
Data members/instance variables:
rate : to store the interest rate in decimals
time : to store the time period in decimals
Methods / Member functions:
Interest( ... ) : parameterized constructor to assign values to the
data members of both the classes
double calculate( ) : to calculate and return the compound interest using the formula [ CI = P ( 1 + R/100 )N − P] where, P is the principal, R is the rate and N is the time
void display( ) : to display the customer details along with the
compound interest
Assume that the super class Bank has been defined. Using the concept of inheritance,
specify the class Interest giving the details of the constructor(...), double calculate( ) and void display( ).
The super class, main function and algorithm need NOT be written.
Solution:
,,
undefined