Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CSE 1 1 0 Lab 7 : Object design and writing classes Lab Exercise: Complete this portion of the lab during your lab session. Lab
CSE Lab : Object design and writing classes Lab Exercise: Complete this portion of the lab during your lab session. Lab Exercise: This portion of the lab should be completed during your lab session. The exercise for this week is to write a class that simulates managing a simple bank account. The account is created with an initial balance. It is possible to deposit and withdraw funds, to add interest, and to find out the current balance. This should be implemented in class named Account that includes: A default constructor that sets the initial balance to zero, account Number to zero, owner Name to an empty string, and the interestRate to zero. Other constructor that takes initial balance, account Number, and the owner Name at the time of object creation A function getBalance that returns the current balance. A method deposit for depositing a specified amount. A method withdraw for withdrawing a specified amount. A method add Interest for adding interest to the account The add Interest method changes the balance in the account to balanceinterestRate display AccountSummary method should display the accountNumber, ownerName, balance, and the interestRate. The UML diagram for the Account class is shown in the following UML diagram. BankAccount balance: double acount Number: int ownerName:string interestRate:double doublegetBalance ; void depositdouble; void withdrawdouble; void addinterest; BankAccount; BankAccountdouble double, int, string displayAccountSummary; Then, include Your Bank Account class in the following program, compile and run. It should produce the following output #include using namespace std; To do : copy and paste your BankAccount implementation here int main BankAccount my Account "John William"; myAccount.deposit; myAccount withdraw; myAccount, addInterest; my Account display AccountSummary; return ; Output: Account Number: Owner's Name : John William Balance : Interest rate :
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