ClassAverage

Objective:
• Creating a program that uses a .txt file as input
• Creating a program that will generate a .txt output file
• Exception Handling Requirements:
You’ll be given a text file, called mstu4031_input.txt. That file will contain a list of grades.
Your job this week is to write a program that will read the file, and then generate an
output file that contains a class average and feedback. If the program cannot find the
input file in your BlueJ project directory, it will throw an IOException.
• Create a BlueJ project
• Add mstu4031_input.txt to the folder
• Now build your program
• Scanner Class
• DecimalFormat Class
• While loop
• Try/catch
• If/else if/else
• The program should produce a .txt output file (it will also live in the BlueJ folder)
o Call it “mstu4031_output.txt”
o List the values on separate lines
o Generate a class average
o Provide a feedback statement
MSTU4031: Lab – Calculating a Class Average Results should look something like this:
***********************************************
* *
* Lab 13 *
* *
***********************************************
Input file name (from your computer): abc.txt
***** ERROR ******
Cannot locate the input file 'abc.txt' on your computer - please try again.
Input file name (from your computer): mstu4031_input.txt
What would you like to call your output file: mstu4031_output.txt
******** INPUT FILE FOUND, OUTPUT FILE GENERATED **********
Your input file, mstu4031_input.txt, has been found and accepted.
Your output file, mstu4031_output.txt, has been created.
mstu4031_output.txt is living in your BlueJ project directory.
Please open mstu4031_output.txt for the class's average and feedback.

Powered by