Question: Need help with a student class that has instance variables for the student's last name and ID number, along with appropriate constructors, accessors, and mutators.

Need help with a student class that has instance variables for the student's last name and ID number, along with appropriate constructors, accessors, and mutators. Make the student class implement the Comparable interface.

  • Define the compareTo method to order student objects based on student ID number. In the main method, create and arrayList / array to store the following list of 7 students. Sort the arrayList /array in ascending order using Arrays.sort and output the list of students.
  • Modify the compareTo method so it orders student objects based on the lexicographic ordering of their last name.

Without modification to the main method, output the students ordered by last name.

Test Data:

ID number

Last name

4327

Smith

4178

Harris

1234

Alleyne

8731

Thakurdin

7622

Poddar

3867

Baker

2519

Mohammed

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!