+1-316-444-1378

Lab 1:

Using the GroceryItem struct from Assignment 5 create a source.cpp file and a main function. Put the GroceryItem struct above int main. We are going to create a grocery store full of items!

Create two copies of this source.cpp file.

Array Version
In the first copy we are going to use a three dimensional array. The three dimensions have size 6, 3, and 5. These represent the aisle, section in the aisle, and the shelf number of the grocery item. Using no loop or selection constructs. Ask the user for the price and location for two grocery items.

Create an instance of the GroceryItem for each, but do not fill out the Location struct. Instead, insert the item in the proper location in the array.

Vector Version
Do the same as in the array version, but instead, make a single dimensional vector of GroceryItems and fill out the Location member in the struct. Simply push_back each grocery item onto the vector.

Lab 2:

We are going to be updating the vector version of assignment 7.

Use a while loop to ask the user if they want to add another item to vector<GroceryItem> store;
If they do:
push an empty GroceryItem struct onto the vector
fill out the struct by using store.back() and asking the user for:
type
price
quantity
name
location
Else exit the loop
use a ranged based for loop to loop over the vector and neatly print out all the information for every GroceryItem in the store vector.

Lab 3:

Write a function called Inventory, that takes a vector of GroceryItems (you decide whether it should be pass-by-reference or pass-by-value). The function should add up the quantity of all the items in the vector and return the sum of all items in the store.