Question: You are given a csv file ( Comma Separated Values ) with rows representing different bank accounts. You must read from these rows and store

You are given a csv file (Comma Separated Values) with rows representing different bank accounts. You
must read from these rows and store their information within a new object of its respective account
class. Then store that object within two maps. You will have store it as a pointer to ensure polymorphism
is maintained. The keys you will need to look up with are the account owners name and the accounts
ID. You will code a functor that takes in the file path of the csv file.
To make things easier you should have the following 2 maps in your functor:
Map 1: ID lookup map. This map will use the owners id as the key and the owners Bank Account
as a value (BankAccount*)
Map 2: Name lookup map. This map will use the owners name as the key and the owners Bank
Account as a value (BankAccount*)
The format of the file is as follows:
Type Name Amount ID
2 Derek Pearce 17731009
1 Ria Marshall 32881010
3 Ronan Walker 89711011
3 Eric Carr 47621012
etc...
The type number will be one of the ints 1,2, or 3 representing Checking, Savings, and Investment
accounts respectively
The options you will have to read (cin) and implement within your call operator:
1. Display all accounts
2. Display all of account type
2.1. Checking Accounts
2.2. Savings Accounts
2.3. Investment Accounts
3. Find account
Integer input for ID search (use stoi!)
String input for name search (HAS TO BE FULL NAME)
Not Found
4.2 Additional Notes
**IMPORTANT** You are expected to use CLI to get the file path from the main and pass it
to the functor. The program will be called in the following format:
./main.out path/to/accounts.csv
We are using stdin (aka cin) for option selection. HOWEVER, note that cin >> name is NOT
the same as getline(cin, name)... this important for when the input has spaces!
Because this part requires you to create new variables and store their pointers in maps, we are
working with dynamic memory. As such you are expected to delete the pointers also!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!