This is in C++. I am struggling. Step 1: Define a struct that can hold information about bank accounts. First:
View the step-by-step solution to:


This is in C++. I am struggling. Please help me understand. If you need more information, please state WHAT info

you need.

Step 1: Define a ​struct​ that can hold information about bank accounts. First:

■ Each instance will hold the name for the account and an account number. We have created an input file that has at least three accounts, called


"moe 6

larry 28

curly 42"

Read a file of account information, filling a vector of account objects. Define local variables corresponding to each data item. Clear the vector, reopen the file (call the open method), and ​repeat the above, except using curly braced intializers to intialize the instance. Close the file and display all objects.

Step 2: Define a ​class t​o hold accounts. Redo the above steps from task 1 that you did with the struct version.

■ Use the ​same​ stream variable! And make sure to display the contents.

Step 3: Add ​transactions​ to your world.

A transaction will be implemented as a class and have a field to indicate whether this is a deposit or a withdrawal and a field to say how much is being deposited or withdrawn. The account class will keep track of transactions applied to it. It will need a vector to store this history of transactions. It will also need a "balance" field to indicate how much is in the account. The account will have methods "deposit" and "withdrawal" which will be passed the amount and will add an appropriate transaction object to the history and modify the balance as needed. The output operator for the account will need to change so that it can display (you format it) the history, i.e. the transactions. When you finish, test this by reading in another file "transactions.txt" that has

commands such as:

"Account moe 6

Deposit 6 10

Withdraw 6 100

Account larry 28

Withdraw 6 100

Deposit 6 10

Deposit 6 10

Withdraw 6 5

Account curly 42"

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. Now make the transaction class private within the account class.

ive posted this queston so many tiems. if somebody could actually look at it and answer.

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.


Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes