Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribed

image text in transcribedimage text in transcribed

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

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

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

1844804526, 978-1844804528

More Books

Students also viewed these Databases questions

Question

Types of cultural maps ?

Answered: 1 week ago

Question

Discuss the various types of leasing.

Answered: 1 week ago

Question

Define the term "Leasing"

Answered: 1 week ago

Question

What do you mean by Dividend ?

Answered: 1 week ago

Question

3 The distinction between microeconomics and macroeconomics.

Answered: 1 week ago