Question: Create a console menu based application that will allow us to do online grocery shopping available for either pickup or delivery. There should be 5

Create a console menu based application that will allow us to do online grocery shopping available for either pickup or delivery. There should be 5 menus that allow the user to choose different items to purchase and checkout listed below:

(1) Pick Up

(2) Delivery

(5) Exit

Main Menu:

(1) Fresh Produce

(2) Meat and Seafood

(3) Frozen Foods

(4) Check Out

Fresh Produce:

(1) Gala apples - $3.99/lb

(2) Banana - $0.48/lb

(3) Grapes - $2.99/lb

(4) Return to Main Menu

Meat and Seafood:

(1) Whole chicken - $6.99/lb

(2) Ground beef - $4.99/lb

(3) Salmon - $9.99/lb

(4) Return to Main Menu

Frozen Foods:

(1) Waffles - $6.99

(2) Pizza - $4.99

(3) Popsicle - $2.99

(4) Return to Main Menu

The first menu allows the user to either pick up or deliver. The delivery option has a $20 fee and $5 tip. Once either pickup or delivery is selected the application will transition to the Main Menu, which is listed as the second menu above. The user has a choice of selecting three menus. These menus are Fresh Produce, Meat and Seafood, Frozen Food, and once the user has chosen all of the items required, there is the menu option of Check Out. All of the menus are listed above in order.

The application should utilize inheritance. There will be two types of grocery items the application will utilize, FreshProduce, which calculates price based on weight in pounds, and MeasuredProduct, which calculates price based on quantity of product. These two types will be child classes of a class Item that holds the name and price of the item, as well as the static data fields delivery and tip.

Item is the super class that holds the fields, there will be no objects instantiated from this class. Below is a listing of all of the fields in the Item class.

price - that holds the final calculated price

name - this is either a string that will hold the name of the item such as apples, pizza

delivery -- is a static field that holds the amount due to delivery. It will be 0 unless delivery is selected. It will be the default delivery fee if delivery is selected.

tip - is a static field that holds the tip due along with delivery. It will be 0 unless delivery is selected. It will be the default delivery fee if delivery is selected.

FreshProduct is a child of Item. Below is a list of all fields and functions in FreshProduce.

field pounds that holds the number of pounds a user has selected of an item

function calculatePrice that will calculate the total price of the item based on the product of the per pound cost times the number of pounds

functions getPounds and setPounds to get and set the field pounds

the constructor for FreshProduct will pass to the super class the values for the name and the price.

MeasuredProduct is a child of Item. Below is a list of all fields and functions in MeasuredProduct.

field quantity that holds the quantity of the items the user has selected

function calculatePrice that will calculate the total price of the item based on the product of the total quantity of items and the item cost

functions getQuantity and setQuantity to get and set the field of quantity

the constructor for FreshProduct that will pass to the super class the values for the name and the price.

The object that the user creates by selecting the items from the online grocery store will be stored in a vector array of Item object pointers named cart. Once the user has selected to checkout, the vector will be traversed and each selected item's name and price will be printed out to the console.

There should be no Item object created, all objects will be FreshProduce or MeasuredProduct

The vector is an array of Item pointers not a vector array of FreshProduce or MeasuredProduct

The vector array of pointers should be declared as a global variable in the main.cpp

All field data is private

Use .h files for class definition

Use .ccp files for class implementation

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!