Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement the member functions and in main() write a driver program to test the

ID: 3620024 • Letter: I

Question

Implement the member functions and in main() write a driver program to test the class.

I just have no idea as to where to start and am banging my head up over this one. :/

#include <iostream>
using namespace std;

class SavingsAccount
{
public:
SavingsAccount(double b) { savingsBalance = b >= 0 ? b : 0; }
void calculateMonthlyInterest();
static void modifyInterestRate( double );
void printBalance() const;
private:
double savingsBalance;
static double annualInterestRate;
friend double getInterestRate(SavingsAccount);
};
double SavingsAccount::annualInterestRate = 0.0;

Explanation / Answer

Dear, Here is the code //Header file section #include using namespace std; class SavingsAccount { public: SavingsAccount(double value); static double annualInterestRate; void calculateMonthlyInterest(); static void modifyIntererestRate(double value); double GetBalance() const { return savingsBalance; } private: // Each member of the class contains a private data member // savingsBalance indicating the amount the saver currently has // on deposit. double savingsBalance; }; // copy constructor to initialize the value at instantiation SavingsAccount::SavingsAccount(double b) { savingsBalance = b>= 0 ? b : 0;; } // Use a static data member annualInterestRate to store the annual interest // rate for each of the savers. double SavingsAccount::annualInterestRate = 0; // Provide member function calculateMonthlyInterest that calculates the void SavingsAccount::calculateMonthlyInterest() { savingsBalance += ((savingsBalance * annualInterestRate) / 12); } //Provide a static member function modifyIntererestRate that sets the // static annualInterestRate to a new value. void SavingsAccount::modifyIntererestRate(double value) { annualInterestRate = value; } int main() { // Instantiate two different objects of class SavingsAccount SavingsAccount account1(2000.00); SavingsAccount account2(3000.00); // Set the annualInterestRate to 3%. SavingsAccount::modifyIntererestRate(3); // Then calculate the monthly interest and print the new balances for // each of the savers. account1.calculateMonthlyInterest(); cout