Programming Problems 1. Total Sales
In the Chap07 folder of the Student Sample Programs, you will find a file named Sales.txt. Figure 7-44 shows the file's contents displayed in Notepad. Create an application that reads this file's contents into an array, displays the array's contents in a ListBox control, and calculates and displays the total of the array's values.
Figure 7-44 The Sales.txt file
Sales.txt - Notepad
File Edit Format View Help
1245.67
1189.55
1098.72
1456.88
2109.34
1987.55
1872.36
2. Sales Analysis
Modify the application that you created in Programming Exercise 1 so it also displays the following:
- The average of the values in the array
- The largest value in the array
- The smallest value in the array
3. Charge Account Validation
In the Chap07 folder of the Student Sample Programs, you will find a file named ChargeAccounts.txt. The file contains a list of a company's valid charge account numbers. There are a total of 18 charge account numbers in the file, and each one is a 7-digit number, such as 5658845. Create an application that reads the contents of the file into an array or a List. The application should then let the user enter a charge account number. The program should determine whether the number is valid by searching for it in the array or List that contains the valid charge account numbers. If the number is in the array or List, the program should display a message indicating the number is valid. If the number is not in the array or List, the program should display a message indicating the number is invalid.