Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 1: Part 2: Section C Design a set of classes and functions to manage an online store. The first class should represent an item

Part 1:

image text in transcribed

Part 2:

image text in transcribed

Section C Design a set of classes and functions to manage an online store. The first class should represent an item that can be bought in the store. An item should have a user-friendly name (i.e. "Book") represented as a std::string as well as an id which should be represented as a long value. Every item should have a price represented as a double as well as an int indicating how many are in stock. The second class should represent a store, which contains a list of all the items currently available in the store. Represent this as an array of Item objects. Assume that there will never be more than 100 objects in the list. Provide a function to print out the full contents of the store with each item and the number of that item in stock: example Store: Book x 12 Colored pencils x 15 Coloring Paper x 20 Markers x 50 Crayons X 3 Staples x 7 NOTE: Keep in mind that you are only writing the classes and functions. You can provide example code that actually creates an instance of this class and calls the function to print the result as in the above example, but I will not be checking for this or running these test functions. I am only going to look at the class and function definitions so ensure that they would behave according to the above example, given the right setup and input. The third class should represent an order. An order should consist of a list of items. Assume there are never more than 10 items in the order's list. Provide a member function that allows you to add items to the order, as well as a getter function that returns the total price of all the items in the current order. NOTE: You are free to use std::vector rather than raw arrays for this assignment, however this is not required since we have not yet learned about using std::vector. Add a non-member output stream overload to print a store item which takes an item by const reference. Make sure this function prints out all the data including the name, id, price, and quantity in stock. Convert the function that prints a store information to a non-member output stream overload which takes a store by const reference. Add a function called processOrder to the store class that takes a const reference to an order object. This function should remove all the items in the order from the store. For example, if I have a store with 5 books and 3 colored pencils and an order for 2 books and 1 colored pencil. The result of this function should be that the store now contains 3 books and 2 colored pencils

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

More Books

Students also viewed these Databases questions

Question

5. Have you any experience with agile software development?

Answered: 1 week ago