slanted W3C logo

Lab 08

Some notes on Check08C.

Student

A Student has a collection of courses.

A course is simply a Java String.

A course grade is also a Java String.

Student stu = Student.getRandom();

for (String course : stu)
{
   output.printf("%s : %s%n", course, stu.getCourseGrade(course));
}

GPA

A Student knows how to compute their own GPA over all courses using the method getGpa.

output.printf("GPA : %s%n", stu.getGpa());

GPA of all Year X Courses

Check08C requires you to search for all courses in a specified year and compute the GPA for those courses.

The search is not difficult; simply traverse the courses held by the student and examine the first character of the course name.

But how do you compute the GPA of the found courses?

GPA of all Year X Courses

Hint: Student has a collection of courses and Student knows how to compute its own GPA. If you create a new Student with no courses, you can add all of the found courses to the student, and then ask it for the GPA.