Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assignment # 2 ( 1 0 points ) Create an inheritance hierarchy containing base class Account and derived class CheckingAccount that inherit from class Account.
Assignment # points
Create an inheritance hierarchy containing base class Account and derived class CheckingAccount that inherit from class Account.
tableAccount classData member,Data member of type double to represent the account balance.,ptConstructortableShould receives an initial balance and uses it to initialize the data member. Theconstructor should validate the initial balance to ensure that it is greater than orequal to If not, the balance should be set to and the constructor should display anerror message, indicating that the initial balance was invalidpttableMemberfunctionstable Member function credit should add an amount to the current balance. Member function debit should withdraw money from the Account andensure that the debit amount does not exceed the Account's balance.If it does, the balance should be left unchanged and the function shouldprint the message "Debit amount exceeded account balance"ptCheckingAccount classData member,Data member of type double that represents the fee charged per transaction.,ptConstructortableShould receive the initial balance, as well as a parameter indicating a feeamountpttableMemberfunctionstableRedefine member functions credit and debit as follows: CheckingAccount's versions of these functions should invoke the baseclassAccount version to perform the updates to an account balance. CheckingAccount's debit function should charge a fee only if money isactually withdrawn ie the debit amount does not exceed the accountbalanceHint: Define Account's debit function so that it returns a bool indicating whethermoney was withdrawn. Then use the return value to determine whether a feeshould be charged.ptMain function to test classes table Write a proclasstablegram that creates objects of each class and tests one member function for eachpt
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started