Question: Exercise 1 : ( Ref: Fig 9 . 2 8 to 9 . 3 0 ) a ) Develop a SavingsAccount class. Use a static

Exercise 1: (Ref: Fig 9.28 to 9.30)
a) Develop a SavingsAccount class. Use a static data member annualBonusRate to store the annual bonus rate for each of the savers (i.e. objects).(Hint: 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 12 ; 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, saver1 and saver2, with balances of $2000.00 and $3000.00, respectively.
Set annualBonusRate to 3 percent only once.
Then calculate the monthly bonus and print the new balance for object, saver1.
Will the annualBonusRate be same for all objects? Explain your answer.
Exercise 1 : ( Ref: Fig 9 . 2 8 to 9 . 3 0 ) a )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!