Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Suppose you are creating a program that makes it easier to read and load shopping lists to allow better shopping for groceries and necessities. You
Suppose you are creating a program that makes it easier to read and load shopping lists to allow better shopping for groceries and necessities. You start with a simple grocery list with the columns as Item Name, Quantity, and Price. You want to read your shopping list file such that it reads those three columns and loads them into a vector of Items struct Item \{ std::string itemName; int quantity; double price; \}; You are given a file in the format Item Name 1 Quantity 1 Price 1 Item Name 2 Quantity 2 Price 2 For example, Apples 105.99 Tomatoes 53.99 Quantities are integers, and prices are doubles, so be very careful when reading and parsing those. Throw an exception when Quantity is not an integer or Price is not a double. Implement function LoadItemsToVector with the filename as the input in order to read the items from the file. After binding the file name to an input file stream, check whether the file is open. If it is not open, throw any exception. If the file is empty, return an empty vector. Note: We are unable to provide you with "Run" functionality on this exercise. Therefore, we highly recommend that you work on this problem inside your CS 128 development environment and submit your solution code here to verify its correctness. 22c-file-streams-shopping-list 22c-file-streams-shopping-list shoppinglist.hpp shoppinglist.cc item.hpp CS 128 A+ Editor 22c-file-streams-shopping-list shoppinglist.hpp shoppinglist.cc item.hpp CS 128 A+ Editor
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started