Question: in c++ QUESTION 1: Create an inheritance hierarchy that a bank might use to represent customers' bank accounts. All customers at this bank can deposit

in c++
in c++ QUESTION 1: Create an inheritance hierarchy that a bank might
use to represent customers' bank accounts. All customers at this bank can
deposit (1.e. credit) money into their accounts and withdraw (ie debit) money

QUESTION 1: Create an inheritance hierarchy that a bank might use to represent customers' bank accounts. All customers at this bank can deposit (1.e. credit) money into their accounts and withdraw (ie debit) money from their accounts. More specific types of accounts also exist Savings accounts, for instance, cam interest on the money they hold. Checking accounts, on the other hand, chutge a fee per transaction (ie, credit or debit) Create an inheritance hierarchy containing base class Account and derived classes Savings Account and shocks Account that inherit from class Account Base class Account should include: One data member of type double to represent the account balance The class should provide a constructor that receives an initial balance and use it to initialize the data member. The constructor should validate the initial balance to ensure that it's 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 The class should provide member functions Member function credit should add an amount to the current balance Member function debit 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" Member function etBalance should return the current balance. Virtual member function named print to print the details of the account QUESTION 2: Derived class Savings Account should inherit the functionality of an Account, but also include: A data member of type double indicating the interest rate (percentage) assigned to the Account SavingsAccount's constructor should receive the initial balance, as well as an initial value for the Savings Account's interest rate Savings Account should provide in public member function calculatinterest that returns a double QUESTION 2: Derived class Samues.Account should inherit the functionality of an Account, but also include: A data member of type double indicating the interest rate (percentage) assigned to the Account Savings&ccounts constructor should receive the initial balance, as well as an initial value for the SavinesAccount's interest rate. Savings Account should provide a public member function calculateinterest that returns a double indicating the amount of interest earned by an account Member function calculateInterest should determine the amount by multiplying the interest rate by the account balance Overnide the print function to print all the details of the object QUESTION 3: Derived class CheckingAccount should inherit from base class Account and include An additional data member of type double that represents the foe charged pet transaction Checking Account's constructor should receive the initial balance, as well as a parameter indicating a fee amount Class CheckingAccount should redefine member functions credit and debit so that they subtract the fee from the account balance whenever either transaction is performed successfully Checking Account's versions of these functions should invoke the base class Account version to perform the updates to an account balance CheckinuAccount's debit function should charge a Yee only if money is actually withdrawn (ie the debit amount does not exceed the account balance) QUESTION 4: write a driver function to test your classes, such that: 1. Define an Array size 10 to track the Accounts of both types. 2. Read the information of 10 Accounts and store them inside the array defined in the previous step The user will be asked to specify the type of the account, and then input data according to the type of the account 3. Print all the details of objects of type saving account 4 Make Withdraw, Deposit and print functions pure virtual in Account class and apply proper modification in the derived classes 5. Print the details of all the objects in the array

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!