Question
Lab # 7 Array storage, sorting, and handling partially filled arrays 1. Create a program that reads in a series of sales dollar amounts from
Lab # 7 Array storage, sorting, and handling partially filled arrays
1. Create a program that reads in a series of sales dollar amounts from a file, stores the amounts in an array, processes the array, and outputs to a file and the console the number of sales amounts, the lowest amount, the highest amount, and a complete list of the amounts in order from lowest to highest, and the total of the amounts.
Sample output shown on the next page
. 2. The maximum number of amounts in the file is 20, but it could have less.
The program must keep track of the number of amounts read in and stop at the end of the file.
3. Required functions called from main: (1) opening the files with file failure conditions, (2) reading the input and storing the values, (3) sorting the array, (4) summing the amounts, (5) displaying the data and writing to a file named yourName.txt.
4. Create an input file named salesAmounts.txt with the following values in the order that they appear below vertically in the file. Read until the end-of-file. 29.95 3.55 34.70 12.34 2.67 33.89 24.99 18.45 4.99 16.50 7.57 20.38 9.95
5. Main can only have the variable and array declarations, function calls, and file closing.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started