Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a complete C++ program that defines a 2D array to help manage the inventory of a local supermarket. Each row represents a commodity. Columns

image text in transcribed
Write a complete C++ program that defines a 2D array to help manage the inventory of a local supermarket. Each row represents a commodity. Columns are defined by the figure below. In the table, left four columns are input, right two columns are output. Sale Price Revenue Post- Invent re- Invento The maino0 function does the following. 1) Read the commodity (row) number from the user with proper prompt 2) Populate the columns Sale, Price, and Pre-Inventory using random number generator and assignment statement. 3) Calculate Revenue and Post-Inventory with random data obtained in Step 2). The Revenue should be the product of Sale and Price. The Post-Inventory should be the remaining amount after subtracting Sale from the Pre-Inventory Print out the content of the table (2D array) on the monitor, keeping the table format Note: To use the random number generator, add following code include include srand (time (NULL)) var " rand) scope; // scope is the range starting from 0 Here rando function returns a pseudo-random integral number in the range between 0 and RAND MAX. RAND MAX is library-dependent, but is guaranteed to be at least 32767 on any standard library implementation. The srand(time(NULL)) turns a pseudo random number generator to a practical random number generator by proving current time as a differentiated seed

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

Computer Aided Database Design

Authors: Antonio Albano, Valeria De Antonellis, A. Di Leva

1st Edition

0444877355, 978-0444877352

More Books

Students also viewed these Databases questions

Question

Analyze Sears, using the competitive forces and value chain models.

Answered: 1 week ago