Question: Your first assignment is to create an Account Inheritance Hierarchy. The assignment must be written in C++. . You need to submit a zip file
Your first assignment is to create an Account Inheritance Hierarchy. The assignment must be written in C++.
. You need to submit a zip file
3 header files (one for each class one base class and 2 derived classes).
3 source code files (one for each class implementation).
1 source code file that contains main() to test your classes.
The Account Inheritance Hierarchy has 3 classes.
The base class is Account:
o One data member called balance of data type double. o A constructor that takes one parameter to initialize the data member balance. The
constructor should validate the initial balance to make sure it is more than 0. If the initial balance is less than zero, then set the balance to zero and display an error message.
o A member function called credit to allow the user to add value to the balance. The function should take one parameter and return the new balance.
o A member function called debit to allow the user to withdraw money from the account. The function should check if there is sufficient fund for the withdrawal. The function should take one parameter (the amount of withdrawal) and return true/false (Boolean data type) to indicate the success or failure of the transaction, respectively. Display an error message if there isnt sufficient fund for the withdrawal.
o A member function getBalance to return the accounts current balance. o A member function setBalance to re-initialize the accounts balance.
The class SavingAccount is a class derived from the class Account o The SavingAccount inherits all data members and functions from the base class
Account. o An additional data member of type double indicating the interest rate (percentage)
assigned to the account. o A constructor that receives the initial balance, as well as an initial value for the
SavingsAccounts interest rate.
o A member function calculateInterest that returns a double indicating the amount of interest earned by the account. This member function should not increase the accounts balance.
o A member function setInterest to re-set the accounts interest rate.
o A member function getInterest to return the Accounts current interest rate. The class CheckingAccount is a class derived from the class Account
o The CheckingAccount class inherits all data members and functions from the class Account.
o An additional data member of type double that represents the fee charged for the account.
o A constructor that receives the initial balance, as well as a parameter indicating a fee amount.
o A member function Chargefee that reduces the account balance by the amount of the fee. The function does not return any value.
o A member function setFee to change accounts fee. o A member function getFee to return the accounts current fee.
After class and tests their member functions. Add interest to the SavingsAccount object by first invoking its calculateInterest function, then passing the returned interest amount to the objects credit function. Make sure you test all the public member functions.
defining the classes in this hierarchy, write a program that creates objects of each
MUST BE DONE WITH MICROSOFT VISUAL STUDIO
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
