Question: using this create c++ consule: class Account { long id; double balance; double annualIntrest; public: Account(){ id=0; balance=0; annualIntrest=0; } public: Account(int v_id,double v_balance, double
using this create c++ consule:
class Account { long id; double balance; double annualIntrest; public: Account(){ id=0; balance=0; annualIntrest=0; } public: Account(int v_id,double v_balance, double v_annualIntrest){ id=v_id; balance=v_balance; annualIntrest=v_annualIntrest; } public: int getId(){ return id; } public: double getBalance(){ return balance; } public: double getAnnualIntrest(){ return annualIntrest; } public: double getMonthlyAnnualIntrest(){ return annualIntrest/12; } public: double getMonthlyIntrestRate(){ return (annualIntrest/12)*100; } public: double getMonthlyIntrest(){ return getMonthlyIntrestRate()*getBalance(); } public: void setId(int v_id){ id=v_id; } public: void setBalance(double v_balance){ balance=v_balance; } public: void setAnnualIntrest(double v_annualIntrest){ annualIntrest=v_annualIntrest; } public: bool withdraw(double amount){ if(balance return false; } else{ balance=balance-amount; return true; } } public: void deposite(double amount){ balance=balance+amount; } }; Define 2 additional classes named CheckingAccount and SavingsAccount that will be subclasses of the Account class. The CheckingAccount class should define a data member to represent an overdraft limit and override the withdraw method in order to allow an overdraft. The SavingsAccount class should define a data member to represent a minimum balance. It should override the withdraw method to assess a $10 fee to the account if the account drops below the minimum balance. Add a toString method to the Account class and then override it in the subclasses. The toString method should return string that contains information about the account number and the balance. From main, create objects of type Account, CheckingAccount and SavingsAccount and then demonstrate the new functionality that the classes provide by depositing and withdrawing money from the accounts.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
