Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribed

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

image text in transcribedimage text in transcribed

This is the main function

image text in transcribed

The transactions.txt is below

image text in transcribed

This supposed to be the output

image text in transcribed

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 42

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

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

Differentiate tan(7x+9x-2.5)

Answered: 1 week ago

Question

Explain the sources of recruitment.

Answered: 1 week ago

Question

Differentiate sin(5x+2)

Answered: 1 week ago

Question

Compute the derivative f(x)=1/ax+bx

Answered: 1 week ago

Question

6. Identify seven types of hidden histories.

Answered: 1 week ago

Question

What is the relationship between humans and nature?

Answered: 1 week ago