Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This Program does not implement interest class Account { public: Customer * customer; float balance; int account _ number; std::vector transaction; void add _ interest
This Program does not implement interest
class Account
public:
Customer customer;
float balance;
int accountnumber;
std::vector transaction;
void addinterest;
AccountCustomer c double balance, int num
: customerc balancebalance accountnumbernum
int getaccountnumber const
return accountnumber;
double getbalance const
return balance;
Member functions definitions
virtual void depositdouble amount, Date date;
virtual void withdrawdouble amount, Date date;
virtual std::string tostring const
return "Account : std::tostringaccountnumber
customergetname balance: $ std::tostringbalance;
Customer getcustomer const
return customer;
;
class SavingsAccount : public Account
public:
SavingsAccountCustomer cust, double bal, int accNum : Accountcust bal, accNum
void depositdouble amount, Date date override
balance amount;
transaction.pushbacknew TransactionDEP amount, balance, date;
void withdrawdouble amount, Date date override
if balance amount
balance amount;
transaction.pushbacknew TransactionWD amount, balance, date;
else
std::cout "Insufficient funds for withdrawal. Charging overdraft penalty." std::endl;
balance Senior::OVERDRAFTPENALTY; OVERDRAFT PENALTY IS SAME FOR ALL ACCOUNTS
transaction.pushbacknew TransactionODP Senior::OVERDRAFTPENALTY, balance, date;
void addinterest
double annualinterestrate getannualinterestrate;
double interest balance annualinterestrate;
depositinterest Date; Assuming the interest is added on the current date
transaction.pushbacknew TransactionINT CR interest, balance, Date;
void checkchargedouble amount const
double charge amount Student::CHECKCHARGE;
std::cout "Check charge: $ std::fixed std::setprecision charge std::endl;
double getannualinterestrate const
if dynamiccastcustomer
return Student::SAVINGSINTEREST;
else if dynamiccastcustomer
return Senior::SAVINGSINTEREST;
else if dynamiccastcustomer
return Adult::SAVINGSINTEREST;
;
class CheckingAccount : public Account
public:
CheckingAccountCustomer cust, double bal, int accNum : Accountcust bal, accNum
void depositdouble amount, Date date override
balance amount;
transaction.pushbacknew TransactionDEP amount, balance, date;
void withdrawdouble amount, Date date override
if balance amount
balance amount;
transaction.pushbacknew TransactionWD amount, balance, date;
else
std::cout "Insufficient funds for withdrawal. Charging overdraft penalty." std::endl;
balance Senior::OVERDRAFTPENALTY; Assuming Senior overdraft penalty for any customer type in checking
transaction.pushbacknew TransactionODP Senior::OVERDRAFTPENALTY, balance, date;
void addinterest
double annualinterestrate getannualinterestrate;
double interest balance annualinterestrate;
depositinterest Date; Assuming the interest is added on the current date
transaction.pushbacknew TransactionINT CR interest, balance, Date;
void checkchargedouble amount const
double charge amount Student::CHECKCHARGE;
std::cout "Check charge: $ std::fixed std::setprecision charge std::endl;
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