Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribedimage text in transcribedimage text in transcribed

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, accountNumber to zero, ownerName to an empty string, and the interestRate to zero . Other constructor that takes initial balance, accountNumber, and the ownerName 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 addInterest for adding interest to the account. The addInterest method changes the balance in the account to balance*(1+interestRate) display AccountSummary method should display the accountNumber, ownerName, balance, and the interestRate The UML d iagram for the Account class is shown in the following UML diag ram BankAccount -balance: double -acountNumber: int ownerName:tri -interestRate double +doublegetBalance ); +void deposit(double); +void withdraw(double); +void addlnterest); +BankAccount(); +BankAccount(double, double, int string) + displayAccountSummary; Then, include Your BankAccount class in the following program, compile and run. It should produce the following output #include-iostream> using namespace std; To do : copy and paste your BankAccount implementation here int mainO BankAccount myAccount(1000.50,0.05,1111, "John William"); myAccount.deposit(500); myAccount.withdraw(200); myAccount.addInterest( myAccount. displayAccountSummary0; return 0; Output: Account Number: 1111 Owner's Name : John William Balance Interest rate : 5% 1300.50

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago