1. Engineering
  2. Computer Science
  3. c pls...

Question: c pls...

Question details
C++ pls
Inherit the BankAccount class in two other classes, SavingsAccount, WalletAccount. Make sure you Have all the following methods and data members stated bellow in each class. (10 point) Remember during developing, you should not be rewriting any part of the code. You should call the methods already existing in the father class as part of the new method. » (20 point) On time
Bank Account public: BankAccount ); -BankAccount ); BankAccount (double balance, double interestRate); void setBalance (double balance); void deposit (double addition); void withdraw(double deduction); void setInterestRate(double interestRate); void addInterestO; double getBalance); double getInterestRate); int getLastInterestDate); void printInfo); rotected: double balance , 8.0; double interestRate .e; int lastInterestDate e (1 point) BankAccount (O; Balance, InterestRate and LastInterestDate to 0 (2 point) BankAccount (double balance, double interestRate); Set balance and interestRate to given arguments Set lastInterestDate to today (1 point) void setBalance (double balance); set balance to be equal to the given argument (1 point) void deposit(double addition); add the amount of the addition to the balance (1 point) void withdraw(double deduction); if the balance is enough, deduct the amount of argument form the balance if the balance is not enough, show the message that indicated the issue (1 point) void setInterestRate(double interestRate); set the interestRate to be equal to the given argument
void addInterest i than 30 days, if today lastInterestDate is more than 30 days, calculate the interest and add it the balance also update the lastInterestDate to today (1 point) double getBalance(); return the balance (1 point) double getInterestRate); return the interestRate (1 point) int getLastInterestDate); return the lastInterestDate (2 point) void printInfo); print information about the account Balance: $. Interest Rate: % Last Interest Date:..
Wallet Account lass WalletAccount: public BankAccount ublic: WalletAccount ); -WalletAccount ) WalletAccount (double bal, double rate); double getMaxWalletCapacity); void deposit (double addition); void setBalance (double bal); void printInfo); rivate: double maxWalletCapacity100; (3 point) WalletAccount (); Should be the same as BankAccount. Dont copy and paste code, use BankAccount constructor (3 point) WalletAccount (double bal, double rate); Should be the same as BankAccount. Dont copy and paste code, use relative BankAccount constructor (2 point) double getMaxWalletCapacity); return maxWalletC apacity (3 point) void deposit (double addition); if balance addition doesnt exceed maxWalletCapacity add the addition to the balance Otherwise, show a message that stated the balance would exceed the wallet capacity (3 point) void setBalance (double bal) if bal doesnt exceed maxWalletCapacity, update the balance. Otherwise, show a message that stated the balance would exceed the wallet capacity (2 point) void printInfo); show all information about the account balance: $... interest rate: % last interest date: max wallet capacity: $
※ Savings Account ublic: SavingsAccount ); -SavingsAccount ); SavingsAccount (double bal, double rate, bool lock); void lockAccount O; void removeLockO; void setBalance(double bal); void setInterestRate(double rate); void addInterestO; void deposit (double addition); void withdraw(double deduction); void printInfo); rivate: bool lock- false; void accountLockMessage(); (3 point) SavingsAccount (double bal, double rate, bool lock); The same as BankAccount constructor, also update the lock data member (2 point) void lockAccount ); update the lock member to be true Show a message that states the account is locked. (2 point) void removeLock ; update the lock member to be false Show a message that states the account is open. (3 point) void setBalance (double bal) if the account is not locked, set the balance otherwise, show a message that states access is denied due to account being locked. (3 point) void setInterestRate(double rate); if the account is not locked, set the interest rate otherwise, show a message that states access is denied due to account being locked.
(3 point) void addInterest); if the account is not locked, add the interest otherwise, show a message that states access is denied due to account being locked. (3 point) void deposit (double addition); if the account is not locked, execute the deposit otherwise, show a message that states access is denied due to account being locked. (3 point) void withdraw(double deduction) if the account is not locked, execute the withdrawal otherwise, show a message that states access is denied due to account being locked. (3 point) void printInfo); show all the account information balance: $... interest rate: % last interest date: lock: true or false
(5 point) In order to test your classes, put the following code in your main function int main() SavingsAccount saving (10ee, 0.02, saving.printInfo) saving.withdraw(200); saving.removeLock(); saving.withdraw(300); saving.withdraw (1000); saving.lockAccount (); saving.deposit (2000); saving.printInfo); true); WalletAccount wallet (70.0, wallet.printInfoo; wallet.deposit(5e); wallet.printInfo); θ,82);
(10 point) Possible output: Account Information: Balance: $1000 Interest Rate: 2% ast Interest Date: 1/24/2019 The account is locked! Access Denied! Account is locked! The account is now open! ithdraw Denied! Not enough balance! he account is now locked! Access Denied! Account is locked! Account Information: Balance: $700 Interest Rate: 2% ast Interest Date: 1/24/2019 he account is locked! Account Information: Balance: $70 Interest Rate: 2% ast Interest Date: 1/24/2019 ax Wallet Capacity: 10 eposit Denied! exceeding the wallet max capacity! Account Information: Balance: $70 Interest Rate: 2% ast Interest Date: 1/24/2019 ax Wallet Capacity: 108
Hint: To reuse constructor from the base (father) class in the derived (child) class, you can use the following code: 曰SavingsAccount::SavingsAccount(double bal, double rate, bool lock) :BankAccount(bal, rate) this-lock lock;
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution