Question
C++ course we use netbeans 8.2 to do the homework Create a Time class that has three private data members: hour, minute, and second. Define
C++ course
we use netbeans 8.2 to do the homework
Create a Time class that has three private data members: hour, minute, and second. Define appropriate setters and getters for these data members. Write a public Display() to display the time in this format: hh:mm:ss. It has ONLY ONE constructor that takes 3 integer arguments to initialize its three data members. Create a SavingsAccount class that has a private data member annualInterestRate that is defined as a reference variable. It is used to refer to another variable that is defined in main() stores the annual interest rate for each of the savers. You will need to write an appropriate constructor to initialize this reference variable, and other data members described in next paragraph. The class also contains a private data member savingsBalance indicating the amount the saver currently has on deposit, as well as a data member updatedTime indicating what time the balance was updated. 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, and the updatedTime should be updated to the current time. Write a driver program to test class SavingsAccount. Instantiate two different objects of class SavingsAccount, saver1 and saver2, with balances of $5000.00 and $10000.00, respectively. Set the annualInterestRate to 1.5 percent. Then calculate the monthly interest and print the new balances for each of the savers. Then set the annualInterestRate to 3 percent, calculate the next months interest and print the new balances for each of the savers. Sample of Execution: Initial balances: Saver 1: $5000.00, updated: 12:22:88 Saver 2: $10000.00, updated: 12:22:88 Balances after 1 month's interest applied at .015: Saver 1: $5006.25, updated: 12:25:88 Saver 2: $10012.50, updated: 12:25:88 Balances after 1 month's interest applied at .03: Saver 1: $5018.77, updated: 12:35:88 Saver 2: $10037.53, updated: 12:35:88
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started