Question
Sales Data Analysis You are tasked with creating an application that reads a files contents (File: SalesData) into an array, displays the arrays contents in
Sales Data Analysis
You are tasked with creating an application that reads a files contents (File: SalesData) into an array, displays the arrays contents in a ListBox control (Chapter 4), and calculates and displays the total, average, max, and min of the arrays values into a file called "SalesResults.txt". You will use a loop (Chapter 5) to read in the data from the file (Chapter 5), store the data into an array (Chapter 7), and save calculated results into a file (Chapter 5). Place the code in the Load event (Chapter 5) so that it will process all of the steps once the application starts.
Data in SalesData.txt File
This is the design of the application.
A message confirms that the data has been processed:
This image shows the applications form after the data has been processed:
This image is the SalesResults.txt file after the data has been processed:
NOTE:
Save the SalesData.txt file in the /bin/Debug folder so that you can simply write "SalesData.txt" for the file name when reading in the file. Once the file is stored in this folder, you won't have to include the file path for the application to find the file.
The output file should be named "SalesResults.txt" and will get stored in the /bin/Debug folder.
Point Breakdown:
Points | Task |
5 | An array is created using a constant to store the size of the array. |
10 | The data file is opened and closed properly using StreamReader. |
10 | The data is read into the application from the file and stored into an array using a while loop. |
15 | The data in the array is totaled using a foreach loop. The average, the maximum, and minimum value in the array is calculated using a for loop. |
7 | The data file is opened and closed properly using StreamWriter. |
3 | All controls have meaningful names.
|
50 | TOTAL |
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