Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In c++ with classes and header files create a program should read data from an input file and write the report to the output file.

In c++ with classes and header files

create a 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.

Here are the Funtions with the purpose and the parameters with the return type

ReadSalesFromFile: Reads sales data from the given filename and populates multiple arrays of data.

Parameters(4): inputfilename, first name array, last name array, and sales array.

Return Type: void

SalesReport :Writes a sales 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 FindMaxSalesIndex, FindMinSalesIndex, CalculateAvgSales, and CalculateTotalSales functions to get data to write in the report.

Parameters(5): outputfilename, first name array, last name array, sales array, number of element in array.

Return Type: void

FindMaxSalesIndex: Searches the sales array for the maximum sales amount. It should return the index of the maximum sales. It should set the maximum sales reference parameter to the maximum sales in the array. This function should not print anything on screen.

Parameters(3): sales array, number of element in array, maximum sales (pass by reference).

Return Type: int

FindMinSalesIndex: Searches the sales array for the minimum sales amount. It should return the index of the minimum sales. It should set the minimum sales reference parameter to the minimum sales in the array. This function should not print anything on screen.

Parameters(3): sales array, number of elements in array, minimum sales (pass by reference).

Return Type: int

CalculateAvgSales: Calculates the average sales for the array. This function should not print anything on screen.

Parameters(2): sales array, number of element in array

Return Type: double

CalculateTotalSales: Calculates the total sales for the array. This function should not print anything on screen.

Parameters(2): sales array, number of element in array

Return Type: double

Inputfile with this data:

FirstName

LastName

Sales

FirstName

LastName

Sales

data of inputfile:

Jane Smith 100

Rose Diaz 200

John Williams 150

Felicia Johnson 250

Ron Davis 75

example pf what outputfile should look like:

Sales Report

------------

First Last Sales

----- ---- -----

Jane Smith 100.00

Rose Diaz 200.00

John Williams 150.00

Felicia Johnson 250.00

Ron Davis 75.00

Average Sales: 155.00

Total Sales: 775.00

Max Sales Name: Felicia Johnson

Max Sales Amount: 250.00

Min Sales Name: Ron Davis

Min Sales Amount: 75.00

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 And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions

Question

a. Describe the encounter. What made it intercultural?

Answered: 1 week ago