I got this question:
Create a SavingAccount class. Use a static data member annualInterestRate to store the annual interest rate for each of the savers. Each member of the class contains private data members: firstName, lastName, and savingsBalance to indicate the amount the saver currently has on deposit. Provide member function calculateMonthlyInterest that calculates the monthly interest by multiplying the balance by annualInterestRate divided by 12; this interest should be added to savingsBalance. Provide a static member function modifyInterestRate that sets the static annualInterestRate to a new value. Also, provide appropriate constructor, set functions, and get functions.
I did the definitions already. How would I write the implementation cpp file for it. I don't know much about this subject so any help is appreciated.
This is the definition I have:
#ifndef SAVINGACCOUNT_H
#define SAVINGACCOUNT_H
class SavingAccount
{
public:
/** Default constructor */
SavingAccount();
/** Default destructor */
~SavingAccount();
string getfirstName() const
string getlastName() const;
static double modifyInterestRate();//static method declaration
static double calculateMonthlyInterst(double,double);
void setannualInterestRate(double)
double getannualInterestRate() const;
private:
string firstName;
string lastName;
double savingsBalance;
static double annualInterestRate;
};
#endif // SAVINGACCOUNT_H