Description
Objectives
• Exposure to testing
• Practice writing static methods that take Objects and arrays of Objects as parameters
Part I
1. Download Lab2Tester.java, Lab2.java and Student.java to your Lab2 working directory.
2. Compile and run Lab2Tester.java. There should not be any compilation errors.
3. Complete the methods in Lab2.java and overviewed in the following UML diagram.
a. The documentation for each method is in Lab2.java. Read the documentation provided
before each method to understand what we are asking you to implement. The tests written
in Lab2Tester.java for each of the Lab2.java methods will provide additional insight on how
we expect each method to be implemented
b. Write and test each method one at a time.
CHECKPOINTs (Ungraded) – if after reading through the documentation and tests for any of the methods
you are required to implement you are still unsure what the method is supposed to do, don’t hesitate to ask
a TA for an explanation of what is expected.
SUBMISSION (Graded) – Submit the Lab2.java file into the Lab2 submission page on ConneX.
Student
– sID: String
– grade: int
+ Student()
+ Student (String, int)
+ getSID(): int
+ setSID(String): void
+ getGrade(): int
+ setGrade(int): void
+ toString(): String
+ equals(Student): boolean
Lab2
+ getHigherGradeStudent(Student, Student): Student
+ isGradeAbove (Student, int): boolean
+ getClasslist(Student[]): String[]
+ countAbove(Student[], int): int
+ getClassAverage(): double
+ registerStudent(Student[], Student): Student[]