Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could you help me to understand how to write this code? For this quest, you are going to start with the Account and Transaction structs

Could you help me to understand how to write this code? For this quest, you are going to start with the Account and Transaction structs from the previous quest and write four functions:
addTransaction will ask for information for a transaction, check for valid date input, and create the newly created Transaction. Try to use uniform initialization for the return instead of creating a temporary variable.
newAccount takes in the last ID used for an account, increments it and asks for all the information for a new Account, except for the ID. The past in and incremented ID is used for that. Again, try to use uniform initialization for the return value.
getCurrentBalance calculates and returns the current balance of a passed in instance of the Account struct. This will need to be calculated based on the beginning balance and transactions on the account.
findAccount uses linear search to find the account by its ID and return the index in the vector for that account. return -1 if not found
For the main function of this quest you will need to create a vector of Account structs and then should present a menu of options for the user.
"Add account" which calls the newAccount function and adds the new account to the vector of accounts
"Add Transaction"
asks for an account ID,
calls findAccount to get the index of the account
calls addTransaction to create a new transaction and pushes it onto the correct Account's transactions vector.
"Get Balance"
asks for an account ID,
calls findAccount to get the index of the account
calls getCurrentBlance, passing in the correct account
displays the account's balance on the terminal.
List Transactions
asks for an account ID
calls findAccount to get the index of the account
displays all transactions neatly on the screen.
HINT:: You may want to create a printTransaction function to help with this!
"Exit Program" This entire menu should be in a while loop that ends when this option is chosen.

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

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions

Question

7. Understand the challenges of multilingualism.

Answered: 1 week ago

Question

5. Give examples of variations in contextual rules.

Answered: 1 week ago