✅ COMP123 - Bonus 3
Hello Hello!
This is your third bonus. This is a bit more challanging as it requires the content of week #6 about File IO. Read carefully.
PROBLEM
Create a console app that reads a file containing a list of numbers, one number per line. The program should then compute the average of these numbers.
However, the program should be able to handle exceptions that might occur during file reading or during the calculation of the average. If an exception occurs, the program should catch it and display an appropriate error message to the user.
The program should meet the following requirements:
The user should be prompted to enter the filename of the file containing the list of numbers.
The program should read the file and extract the list of numbers.
The program should compute the average of the list of numbers.
If an exception occurs during file reading or during the calculation of the average, the program should catch it and display an appropriate error message to the user.
If the file does not exist or cannot be read, the program should catch the exception and display an appropriate error message to the user.
If any of the lines in the file do not contain a valid number, the program should catch the exception and display an appropriate error message to the user.
If the list of numbers is empty, the program should catch the exception and display an appropriate error message to the user.
If the file is successfully read and the list of numbers is computed, the program should display the average to the user.
The program should use try-catch-finally blocks to ensure that any resources are cleaned up correctly, regardless of whether an exception was thrown.
To deliver the code:
Use the previously created account on GitHub.com;
Create a new folder called “Bonus3” on the existing private repository that you shared with me before;
Commit your Bonus 3 code to your GitHub repository inside this folder;
Copy and paste the URL to the GitHub repo in the Bonus folder under eCentennial/Assessments/Assignment/Bonus 3
Due date: Saturday July 15, 2023 @ 11:59pm
Good luck!
Aderson