Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This has to be done in C++ The below are the instructions, basically what has to be done From here is the current code that
This has to be done in C++
The below are the instructions, basically what has to be done
From here is the current code that I have and need to build on please use this
There are two classes and a part of the main function
This is the main function
The transactions.txt is below
This supposed to be the output
Please improve on build on the code that I already have and fix anything when necessary with the comments for why you did so
Add transactions to your world. a. A transaction will be implemented as a class. Define the class outside of the account class. It will have - a field to indicate whether this is a deposit or a withdrawal. - a field to say how much is being deposited or withdrawn. - An output operator. Define the output operator outside of the transaction class. b. The account class will keep track of transactions applied to it. Define a new account class for task 3 . It will need - a vector to store this history of transactions. - a "balance" field to indicate how much is in the account. c. How will we use this? - The account will have methods "deposit" and "withdrawal" which will - be passed the amount - will add an appropriate transaction object to the history - and modify the balance as needed. d. Output operators - Define the output operators for both the account class and the transaction class outside of the classes. (Yes, you can make them friends.) - The account's output operator will need to also display (you format it) the history, i.e. the transactions. e. Test the above code out by reading in a file (transactions.txt) that has commands such as - Account moe 6 Deposit 610 Account larry 17 Withdraw 6100 - Note that the number 6 in the deposit and withdraw commands refers to the account. You will have to locate the account in your collection of accounts. - Withdrawals should not be allowed to put the account in the red, so if there are insufficient funds in the account then generate an error message and go on. Account moe 6 Deposit 610 Withdraw 6100 Account larry 28 Withdraw 28100 Deposit 2810 Deposit 2810 Withdraw 285 Account curly Task 3: Accounts and Transaction: Account\# 6 has only 10. Insufficient for withdrawal of 100. Account\# 28 has only 0 . Insufficient for withdrawal of 100. moe 6 : deposit 10 larry 28: deposit 10 deposit 10 withdrawal 5 curly 42Step 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