Question: 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

 Write a complete C++ program that defines a 2D array to

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

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!