Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please C ++ only with extra credit. Use arrays to track number of items sold for three inventory items from your food kiosk. Each of

Please C ++ only with extra credit.

Use arrays to track number of items sold for three inventory items from your food kiosk. Each of the three items has a number sold per day for one week. Program needs to track all the items sold, determine the average daily number sold, and determine the highest and lowest amount sold of any inventory item on a single day. For EXTRA CREDIT, the program also determines which inventory item had the most number of days with the highest number sold.

Step 1. Declare global constants: The number of inventory items (value = 3) The number of days (value = 7)

In main, declare a one-dimensional string array that will hold the three inventory items. Use the three inventory items from the food kiosk (sandwiches, french fries and beverage; platters are not an individual item for inventory purposes).

In main, declare a two-dimensional array that will hold the number of items sold for each item for each day. NOTE: Be sure to use the test data from Step 3 below. Call a function to display the program title, copyright notice and program introduction.

Step 2. Fill the arrays: Declare the two arrays (one-dimensional for the three items and two-dimensional for amount sold), initialize the arrays with the data to be used in the project. Use the test data below (see Step 3).

Step 3) Create a function that prints the contents of the two arrays in this format:

Nameday 1day 2day 3day 4day 5day 6day 7
Sandwiches72717071696775
french fries69726472746671
beverages68747367727065

In the function heading, declare both arrays as constant arrays. Format as closely as possible, but don't obsess too much over perfection. The numbers must line up under the days, but they do not need to be exactly in the middle.

Step 4. Create a function that calculates and displays the average number of items sold over the seven days. In that function, display the averages with to one decimal place of precision. Report the results in the following format:

NameAverage sold
sandwiches(report the results)
french friesetc.
beveragesetc.

In the function heading, declare both arrays as constant arrays.

Step 5. Create a function that determines the one item that sold the lowest amount on a given day. Output the results in that function using the following format:

Item [item number] sold the lowest amount [value] on Day # [value of day].

In the function heading, declare both arrays as constant arrays. Place the inventory item name in the output above.

Step 6. Create a function that determines the one item that sold the most on a given day. Output the results in that function using the following format:

Item [item number] sold the lowest amount [value] on Day # [value of day].

In the function heading, declare both arrays as constant arrays. Place the inventory item name in the output above.

Step 7. Create a function that displays the item that sold the most over the most number of days. Output the results in that function using the following format:

Item [item number] had the most number of days with the highest sales, [number of days] days.

In the function heading, declare both arrays as constant arrays.

Notes: ? Use the test data and formatting as required above for the screenshot. ? Use good documentation the constants, variables, functions. ? Use variables and function names that are clear and self-explanatory. ? Pass the arrays as constants where appropriate. ? Use good spacing in both the code and the output.

image text in transcribed
Enter name of the inventory item: sandwiches Enter the number of sandwiches sold on day 1: 72 Enter the number of sandwiches sold on day 2: -1 Error - The number of sandwiches must be greater than zero. Please reenter: 71 Enter the number of sandwiches sold on day 3: 70 Enter the number of sandwiches sold on day 4: 71 Enter the number of sandwiches sold on day 5: 69 Enter the number of sandwiches sold on day 6: 67 Enter the number of sandwiches sold on day 7: 75 Enter name of the inventory item: french fries Enter the number of french fries sold on day 1: 69 Enter the number of french fries sold on day 2: 72 Enter the number of french fries sold on day 3: 64 Enter the number of french fries sold on day 4: 72 Enter the number of french fries sold on day 5: 74 Enter the number of french fries sold on day 6: 66 Enter the number of french fries sold on day 7: 71 Enter name of the inventory item: beverages Enter the number of beverages sold on day 1: 68 Enter the number of beverages sold on day 2: 74 Enter the number of beverages sold on day 3: 73 Enter the number of beverages sold on day 4: 67 Enter the number of beverages sold on day 5: 72 Enter the number of beverages sold on day 6: 70 Enter the number of beverages sold on day 7: 65 Item Day 1 Day 2 Day 3 Day 4 Day 5 Day 6 Day 7 sandwiches 72 71 70 71 69 6/ 75 french fries 69 72 64 72 74 66 71 beverages 68 74 73 67 72 70 65 Item Average Sold sandwiches 70.7 french fries 69.7 beverages 69.9 Item french fries sold the lowest amount, 64, on day 3. Item sandwiches number the highest amount, 75, on day 7. Item beverages had the most days with the highest sales , 3 days! Press any key to continue

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions