Question: Create an inheritance hierarchy containing base class Account and derived classes Savingsad count and CheckingAccount that inherit from class Account Base class: Account Data member:

Create an inheritance hierarchy containing base class Account and derived classes Savingsad count and CheckingAccount that inherit from class Account Base class: Account Data member: Data member of type double to represent the account balance Constructor: Should receives an initial balance and use it to initialize the data member. The constructor should validate the initial balance to ensure that it is greater than or equal to 0.0. (If not, the balance should be set to 0.0 and the constructor should display an error message, indicating that the initial balance was invalid). Member functions : Member function Setcredit should add an amount to the current balance Member function Setdebit should withdraw money from the Account and ensure that the debit amount does not exceed the Account's balance.(If it does, the balance should be left unchanged and the function should print the message "Debit amount exceeded account balance"). no vector Member function getBal should return the current balance. Derived class: SavingsAccount just array or pointer Data member. Data member of type Float indicating the interest rate (percentage) assigned to the Account. Constructor: Should receive the initial balance, as well as an initial value for the Savings Account's interest rate. Member functions: Member function calculatelnterest that returns a double indicating the amount of interest earned by an account. Member function calculatelnterest should determine this amount by multiplying the interest rate by the account balance. [Note: Savings Account should inherit member functions credit and debit as is without redefining them.] Derived class: Checking Account Data member: Data member of type double that represents the fee charged per transaction. Constructor: Should receive the initial balance, as well as a parameter indicating a fee amount Member functions: Redefine member functions Setcredit and Setdebit as follows:Checking Account's versions of these functions should invoke the base-class Account version to perform the updates to an account balance. CheckingAccount's debit function should charge a fee only if money is actually withdrawn (i.e., the debit amount does not exceed the account balance),[Hint Define Account's debit function so that it returns a bool indicating whether money was withdrawn. Then use the return value to determine whether a fee should be charged.] Main function (to test classes ): Write a program that creates objects of each class and tests their member functions. Add interest to the SavingsAccount object by first invoking its calculatelnterest function, then passing the returned interest amount to the object's credit function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
