Wednesday, 19 February 2014

Visual Basic Programming

Question 1
(Savings Account Class) Create class SavingsAccount. Use a Shared class variable to store the annualInterestRate for all SavingsAccounts. Each object of the class contains a Private instance variable savingsBalance indicating the amount the saver currently has on deposit. Provide theCalculateMonthlyInterest method to calculate the monthly interest by multiplying the savingsBalance by the annualInterestRate divided by 12; this interest should be added to savingsBalance and returned to the method caller. Provide a Shared method ModifyInterestRate that sets the annualInterestRate to a new value. Write an application to test class SavingsAccount. Instantiate two SavingsAccount objects, saver1 and saver2, with balances of $2000.00 and $3000.00, respectively. Set annualInterestRate to 4%, then calculate the monthly interest and display the amounts of interest earned and the new balances for each of the savers. Then set the annualInterestRate to 5% and calculate the next month’s interest and display the amounts of interest earned and the new balances for each of the savers.

No comments:

Post a Comment