You are on page 1of 1

AP Computer Science U4p4b - Student Class p2 Completed?

Lab Goal : This lab is designed to give you more practice writing a compareTo method used in multiple
utility classes.

Lab Description : Alter the program in part 1 above. Before printing the data to the screen, call
Arrays.sort to sort the Student objects based on the Student’s last name.

You must write a compareTo() method for your Student class that will return the appropriate number. Use
String’s compareTo method as an example.

Class Diagram : After part 2, the class structure will look like the diagram below:

Student class implements Comparable

private String id; Student ()


private String name; Student(String line)
private int[] grades;
String getName()
int [] getGrades()
String getId()
double getAverage()
int compareTo(Object o)
String toString()
// Name and Average only

You might also like