Students Needing Help
(Reading and Writing Text Files)
Write a program that will read in a file of student academic credit data and
create a list of students on academic warning. The list of students
on warning will be written to a file. Each line of
the input file will contain a student name (a single String with no spaces),
the number of semester hours earned (an integer), the total quality points
earned (type double) during those semesters. The following shows part of a typical data file:
Smith 27 83.7
Jones 21 28.35
Walker 96 182.4
Doe 60 150
The program should compute the GPA (grade point or quality point average) for each
student (the total quality points divided by the number of semester hours) then write
the student information to the output file if that student should be put on academic
warning. A student should be on warning if he/she has a GPA less than 1.5 for students with
fewer than 30 semester hours credit, 1.75 for students with at least 30 but fewer than 60 semester hours
credit, and 2.0 for all other students (i.e., those with at least 60 hours).
The file Warning.java contains a skeleton of the
program. Do the following:
- Look at the comments containing "===", as well as the header comments of the methods.
- Complete the implementation of openFiles().
Test it by running the program. If all is well, the program should create a file named "warning.txt" that contains ony the header output (see lines 59-61.) Copy the output into the lab document.
- Complete the implementation of shouldBeOnWarning(). Test it by adding debugging code to main() that simply calls shouldBeOnWarning() at least four times, once for each of the possible test cases: student with < 30 hours, between 30 and 60, and more than 60, with quality hours that should result in the the students in or out of academic warning. Copy the output into the lab document.
- Comment-out the debugging code from step 3 (don't delete it).
- Complete generateReport. You might want to add a debugging statement that prints the values as you read them from the input file.
- Test the program. Test data is in the file students.txt. Your program should generate output similar to that in warning.txt.
- Once you believe your program is working properly, you can comment-out the debugging code from step 5.