Reference no: EM132101196
PLEASE WRITE IN C++
Write a program that reads sales data from a file. The program outputs the totals sales, average sales, lowest and highest sales.
Outcomes:
1. Read data from a file into an array.
2. Process data in a partially filled array via functions.
3. Pass an array as a parameter to a function.
4. Use for and while loops when processing an array.
Specifications:
1. Use an array to store the sales data. Sales data should be stored as a double.
2. The company has at most 20 locations. (Max capacity of the array)
3. The input file contains a sales report that list the number of stores reporting data and the sales data.
4. Sample Input file format: (samplefile1 and samplefile2)
3
27648.92 234.83 23458.32
The '3' means that this file contains data for three locations. The numbers represent the sales for each location.
5. The main function should be modular so the main tasks must be handled by functions. Note: this is only an outline of the function requirements. You will need to decide on function names, parameter lists and return types on your own.
6. The tasks are:
a. Ask the user for the file name that contains the sales data. Fill the array with the sales data from a file.
b. Total the sales data.
c. Average the sales data.
d. Determine the highest sales in the report.
e. Determine the lowest sales from the report
7. The main function should output the data to the user.
8. Add code to the main function to allow the user to rerun the program.
9. Sample output:
Enter file name: sales.dat
The total sales are $755260.00
The average sales amount is $ 75526.00
The highest sales amount is $124569.00
The lowest sales amount is $ 35678.00
10. Extra Credit - Write two additional functions:
a. Write a function that sorts the arrays sales data in ascending order. You may not use selection sort. Bubble sort example.
b. Write a function that displays all the elements of the array in a nicely formatted output.
In each of the last five decades i business ethics
: In each of the last five decades i business ethics, which decade saw the most development in business ethics?
|
What is the amount of cash receipts from customers
: Sales revenue was $1,095,307,000 for the year. What is the amount of cash receipts from customers?
|
How do you think so many social media platforms
: How do you think so many social media platforms/messages are able to get away with deceptive advertisement? What are some examples??
|
Write a program that will use a recursive binary search
: Write a program that will use a recursive binary search to locate an integer in a sorted array. The integer values will be provided in a file named dataarray.
|
Determine the highest sales in the report
: Write a function that sorts the arrays sales data in ascending order. You may not use selection sort. Bubble sort example.
|
Write a program to calculate how many squares are required
: There is an old story that the emperor wanted to thank the inventor of the game of chess and asked the inventor to name his reward.
|
Write a program that initially prompts the user for a file
: Write a program that initially prompts the user for a file name. If the file is not found, an error message is output, and the program terminates.
|
Write a program calendar c that takes two inputs
: Write a program calendar.c that takes two inputs: the start day of a month [Sunday is 0, Monday is 1,....., Saturday is 6] and the number of days in a month.
|
Create an array that holds random integers
: Create an array that holds 1000 random integers between 1-1000. Please write a short paragraph, bullet points.
|