Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I WANT THE CODE IN C++. PLEASE SOLVE IT BEFORE 10 HOURS OF POSTING IT. Program Purpose Create a program plan and then convert it

I WANT THE CODE IN C++. PLEASE SOLVE IT BEFORE 10 HOURS OF POSTING IT.

Program Purpose

Create a program plan and then convert it into C++ statements. Practice debugging, declaring variables, file I/O, functions, arrays, sorting and searching arrays.

Mandatory Instructions This assignment will give you practice with functions and arrays covered in Chapter 6-8 of the Gaddis textbook. 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 function call a function to input the data from the file prog1.txt and store the data in 4 arrays, item, qty, location and price. The max number of elements should be set to 30. However, the input function will keeps track of the number of products and return that count to main(). The main() should: 1. Declare all arrays and variables needed 2. Call the ReadData Function to read the data and populate the arrays a. Pass the arguments needed b. Open the file prog1.txt inside this function. c. Use a while loop to read data into the arrays until EOF is reached d. 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 they key. 4. Call the PrintArrays Function that prints the four arrays in tabular form with column headers a. Print the arrays in tubular form using the setw function 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 a tabular form. 6. Call the HiPrice Function to return the subscript of the highest price product in stock. 7. Call the AverWarehouse Function to return the average prices for each of the three warehouses. (see data). (Hint: You will 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 ___________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 Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

Students also viewed these Databases questions

Question

What is an intranet?

Answered: 1 week ago