hw6 - ◊ Use the Student class constructor to read from...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CS112: In-class Exercise 13 HW#6 Modify the reading-students project example from previous InClass exercise. Write a method getAverageGPA(String filename) throws Exception that will open the file filename, which contains many student data, and Study the new format of the file (see “newstudents1.txt”). The file consists of student data, one after the other. Note the order: ID number first. Then the name. Then the GPA. Use the hasNextInt() method to see if there is a next ID number.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ◊ Use the Student class constructor to read from the file. (See how this was done in the example.) You will need to modify the Student class constructor appropriately. Remember to discard the rest of the line after reading a number. ◊ Only report the number of students, and the average GPA. ◊ Do not print out each student’s data (unless you are doing it for diagnostic purposes). ◊ Use the test data “newstudents1.txt” and “newstudents2.txt” to test your program....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online