Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this program I have no idea how to do it. I tried for hours. It needs to be in c++ and

I need help with this program I have no idea how to do it. I tried for hours. It needs to be in c++ and try to make it simple yet still do all the requirements please! The last one I did did not read the file the correct way?

image text in transcribed

The txt file is:

Zip Drive

89

Warehouse C

75.89

Keyboard

133

Warehouse C

25.95

Blu Ray

54

Warehouse J

34.87

Iphone

110

Warehouse M

209.93

Ipod

174

Warehouse M

180.99

DVD Player

85

Warehouse J

124.91

Heat Sink

157

Warehouse C

138.45

Ext Drive

245

Warehouse C

152.87

Speakers

187

Warehouse J

163.55

Camera

147

Warehouse J

138.97

SD Card

100

Warehouse C

18.87

Router

148

Warehouse C

115.28

Printer

125

Warehouse M

145.87

Bluetuth Speakers

102

Warehouse J

19.99

Microsoft Mouse

202

Warehouse J

49.99

USB Hub

7

Warehouse M

29.99

Mousepad

119

Warehouse C

9.99

HDMI cable

23

Warehouse C

32.50

Tablet

56

Warehouse M

199.99

Create a program that will read data from a file called prog1.txt. The data will consist of the product item name, quantity, location and price for products in an inventory. You do not know how many data items there will be in the file and should read the file until no more data is found. Some strings will contain a space (use getline). All of the output for the program will go to the screen. Have the main call a function to input the data from the file progl.txt and store the data in four parallel arrays, item, qty, location and price. The max number of elements should be set to 30 utilize a globally declared named constant. However, the input function will keeps track of the number of products actually read from the file and return that count to main0. It is possible that the data file contains more than 30 items in it, handle that in your function knowing that you only have room for 30 in your arrays. The main) should: . Declare all arrays and variables needed 2. Call the ReadData function to read the data and populate the arrays a. b. c. d. Pass the arguments needed Open the file prog1.txt inside this function. Use a while loop to read data into the arrays until EOF is reached and you have room in the arrays. close the file 3. Call the BSort function to sort all four arrays from highest to lowest by quantity. (WORRY ABOUT THIS FUNCTION LAST, IN THE MEANTIME, USE A STUB) a. Use the bubble sort to sort all four arrays simultaneously using the qty array as the key 4. Call the PrintArrays function that prints the four arrays in tabular form with column headers Print the arrays in tubular form using formatting via the setw function a. 5. Call the Restock function to print each product that is under stock. A product is under stock if it has fewer than 100 items in stock. Display the product item name and quantity in tahular form. Call the HiPrice function to return the subscrint of the highest price product in stock via the return statement. Call the AverWarehouse function to return the average price for each of the three warehouses (see data). (Hint: You will 6. 7. need three sets of counters and accumulators. Lastly, the function will return all three averages via reference parameters). 8. Add code in your main to display the item name, location and price of the highest price product in stock. (Output: The highest priced item is located in warehouse with a price of $ 9. Add code in your main to display the average prices for all three warehouses

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

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions