Question: Exercise 1 : ( Ref: Fig 9 . 2 8 to 9 . 3 0 ) a ) Develop a SavingsAccount class. Use a static
Exercise : Ref: Fig to
a Develop a SavingsAccount class. Use a static data member annualBonusRate to store the annual bonus rate for each of the savers ie objectsHint: declare static variable inside the class but initialize it outside the class
b The class contains a private data member savingsBalance indicating the amount the saver currently has on deposit.
c Provide member function calculateMonthlyBonus that calculates the monthly bonus by multiplying the savingsBalance by annualBonusRate divided by ; this bonus should be added to savingsBalance.
d Provide a static member function modifyBonusRate that has a parameter and use it to set the static annualBonusRate to a new value.
e Write a driver program containing main to test class SavingsAccount.
Instantiate two different objects of class SavingsAccount, saver and saver with balances of $ and $ respectively.
Set annualBonusRate to percent only once.
Then calculate the monthly bonus and print the new balance for object, saver
Will the annualBonusRate be same for all objects? Explain your answer.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
