hopping List Implement a List ADT for storing a list of shopping items. The class must be named ShoppingList and must be implemented using a dynamic array. Set the default array size to 4 (in the de
hopping List Implement a List ADT for storing a list of shopping items. The class must be named ShoppingList and must be implemented using a dynamic array. Set the default array size to 4 (in the default constructor). Three of the member functions will be implemented recursively. Reading in Items You should read in a list of items to add to the shopping list from items.csv using file I/O. Do NOT hard code any data except for the filename. Initialize a ShoppingList and add items until you reach the end of the file. The first column is the name of the item and the second column is the index that the item should be added at. Check the PA 2 instructions on Canvas for more information on file I/O. Operations Implement basic class functions (default and copy constructors, destructor, copy assignment) and the basic list functions (insert, remove, getSize). insert(string s, index i): if there is an item at index i already, make space for the new item by shifting all the items to the right and place the new item at index i. If index i is out of range, print a warning and place the new item at the end of the array. Resize accordingly. remove(index i): returns the item at index i and removes it from the array. Use a recursive helper function to shift elements to the left. Ex. arr = [a,b,c,d,e,f,_ ] remove(2); //returns c arr = [a,b,d,e,f,_,_ ] getSize(): returns the number of items in the list. Also implement two recursive functions below. You can use helper functions as needed. 1. printList(): recursively prints all items on the shopping list (example provided on the next page). 2. findItem(string item): recursively counts and returns how many elements in the array are item.
The CardStack class should be in two files named shopping.h and shopping.cpp. The driver should be in a file named pa2.cpp. EXECUTION EXAMPLE Your class files should support tests such as these: ShoppingList s = ShoppingList(); //code for reading in items.csv s.printList(); arr: banana arr: water arr: chair arr: desk arr: watch arr: pen arr: banana arr: eraser cout << s.remove(1) << ” has been removed.” << endl; prints water has been removed. Printing after remove arr arr: banana arr: chair arr: desk arr: watch arr: pen arr: banana arr: eraser There are 7 items on the list. There are 2 banana(s) on the list.
/// sample for item.csv file