Question
class Account { private: double balance; // Account balance double interestRate; // Annual interest rate double interest; // Annual interest earned int transactions; // Number
class Account
{
private:
double balance; // Account balance
double interestRate; // Annual interest rate
double interest; // Annual interest earned
int transactions; // Number of transactions
public:
/*initialize the balance and interest rate by the parameters or the default values, here is the annual interest rate is 0.045 */
Account(double iRate = 0.045, double bal = 10);
//set the interest rate
void setInterestRate(double iRate);
//make a deposit
void deposit(double amount);
/*withdraw some amount from the balance. If the amount is greater than the balance, the function returns false; otherwise this amount is subtracted from the balance and returns true. */
bool withdraw(double amount);
//calculate annual interest and add it to the balance
void calcInterest();
// retrieve the interest rate
double getInterestRate() const;
// retrieve the balance
double getBalance() const;
// retrieve the annual interest
double getInterest() const;
//retrieve the number of transactions
int getTransactions() const;
//overload equal to operator ==. Two accounts are equal if all of their data members
//are same
bool operator== (const Account& );
};
1.Implement the member function deposit in Account.cpp file.
//make a deposit
void deposit(double amount);
2.Implement the member function withdraw in Account.cpp file.
//withdraw some amount from the balance. If the amount is greater
//than the balance, the function returns false; otherwise this
3.Implement the member function operator== in Account.cpp file.
//overload equal to operator ==. Two accounts are equal if all of their data
// members are same.
bool operator== (const Account& );
//amount is subtracted from the balance and returns true.
bool withdraw(double amount);
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