Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program Overview Write a C++ console application to generate an item report. The program will use arrays and functions. You must use all functions in

image text in transcribed
image text in transcribed
image text in transcribed
Program Overview Write a C++ console application to generate an item report. The program will use arrays and functions. You must use all functions in your program, Your program should read data from an input file and write the report to the output file. The program should ask the user to enter the name of both the input file and the output file. The output file will contain the activity report. DO NOT HARD CODE THE NAMES OF THESE FILES IN THE PROGRAM. IT WILL BE MARKED AS INCORRECT OF THE FILENAMES ARE HARD CODED INTO THE PROGRAM. Again, ask the user to enter both the input and output filenames and then use those files respectively for input and output (sample execution below) In main you will need to declare four arrays. There need to be arrays for the following: An array to hold all the names An array to hold the prices An array to hold the quantities An array to hold the discount percentages Nam Price Art 0-1.50 Quantity 0 -4.00 DSCOACH Sandwich data are located at 1 2 - Sandwich 3. Brownie 2-6.50 These are parallel arrays. All data for one item are located at the same index in each example, all data for Sandwich are located at index 2 of each array. You will need to create an input data file for the program (see format below) Make sure you split up the code into appropriate header files (h) and source files .cpp). All function prototypes should be in another header file(h. All function definitions should be in one source file.cpp). The main function should be in yet another source file.cpp). Functions Here are the functions to create: C++ Function Name Prose Readitems FromFile Reads item data from the given filename and populates multiple arrays of data. THIS FUNCTION SHOULD NOT PRINT ANYTHING ON SCREEN. Only reads from the input file Parameters input filename, name array, price array, quantity array, and discount percentate array. Return Type: void Writes an item report to a given output filename. The report should be formatted the same as the example report given below. You should columns in the body of report set in this Functions Here are the functions to create: C++ Function Name Purpose Readitems FromFile Reads item data from the given filename and populates multiple arrays of data. THIS FUNCTION SHOULD NOT PRINT ANYTHING ON SCREEN. Only reads from the input file. Parameters(5): inputfilename, name array, price array, quantity array, and discount percentage array. Return Type: void Writes an item report to a given output filename. The report should be formatted the same as the example report given below. You should use columns in the body of your report (setw). Inside this function it should call the Find MaxPriceindex, Find MinPriceindex, Calculate AvgPrice, and Calculate TotalPrice functions to get data to write in the report. THIS FUNCTION SHOULD NOT PRINT ANYTHING ON SCREEN. Only write to the output file. Parameters(): outputfilename, name array, price array, quantity array, and discount percentage array. Return Type:void Searches the price array for the maximum price amount. It should return the index of the maximum price. It should set the maximum price reference parameter to the maximum price in the array. THIS FUNCTION SHOULD NOT PRINT ANYTHING ON SCREEN Parameters(2) price array, maximum price (pass by reference). Return Type: int Searches the price array for the minimum price amount. It should return the index of the minimum price. It should set the minimum price reference parameter to the minimum price in the array. THIS FUNCTION SHOULD NOT PRINT ANYTHING ON SCREEN Parameters(2): price array, minimum price (pass by reference). Return Type: int Calculate Avg Price Calculates the average price for the array, THIS FUNCTION SHOULD NOT PRINT ANYTHING ON SCREEN Parameters(1) price array Return Type: double Calculate TotalQuantity Calculates the total quantity for the array. THIS FUNCTION SHOULD NOT PRINT ANYTHING ON SCREEN Calculate TotalQuantity Calculates the total quantity for the array. THIS FUNCTION SHOULD NOT PRINT ANYTHING ON SCREEN Parameters(1): quantity array Return Type: double Input Data File Format Item Name ItemPrice ItemQuantity Item Discount Item Price ItemQuantity Item Discount Sample Input Data File (notice there is no descriptive text, just the data) Sample Report File (1 record per line in report) Quantity Discount Pet

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

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

0201844524, 978-0201844528

More Books

Students also viewed these Databases questions

Question

2. XYZ Company engaged in the following transactions....

Answered: 1 week ago