Question
[Part 1] - Account Class Design a class named Account with Account.h (including class data fields and function prototype) and Account.cpp (including constructor and function
[Part 1] - Account Class Design a class named Account with Account.h (including class data fields and function prototype) and Account.cpp (including constructor and function definitions) that contains: 1.A private int data field named id for the account (default 0). 2.A private double data field named balance for the account (default 0). 3.A private double data field named annualInterestRate that stores the current interest rate (default 0). Assume all accounts have the same interest rate. 4.A constructor that creates an account with the specified id and initial balance 5.The accessor (get) and mutator (set) methods for id, balance, and annualInterestRate. 6.A method named getMonthlyInterestRate() that returns the monthly interest rate. 7.A method named getMonthlyInterest() that returns the monthly interest. 8.A method named withdraw that withdraws a specified amount from the account. 9.A method named deposit that deposits a specified amount to the account. 10.withdraw() should check available balance before withdraw. Throw an Exception if there is no sufficient balance. 11. All getter functions should add the const keyword Write a test program that creates five Account objects. The account IDs are 1000 to 5000, balance of $1,000 to 5000, and an annual interest rate of 3%. Use the withdraw method to withdraw $500, use the deposit method to deposit $1000, and print the account ID, the monthly interest, and the balance for each account via object name. Again, print out account ID and account balance information via object references and object pointers. (Hints) 1. The method getMonthlyInterest() is to return monthly interest, not the interest rate. Monthly interest is balance * monthlyInterestRate. monthlyInterestRate is annualInterestRate / 12. Note that annualInterestRate is a percentage, e.g.,like 3%. You need to divide it by 100.) 2.withdraw() should check available balance before withdraw. Throw an Exception if there is no sufficient balance. 3.You may create five Account objects, or create one size=5 Account array: Account accountArray[5]; or array accountArray;
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