Question: A Student class is create below. You may assume needed constructors, getter and setter methods have been created as well. You can directly use them

A Student class is create below. You may assume needed constructors, getter and setter methods have been created as well. You can directly use them but DON'T need to create them in the class here. Complete the following: 1. Modify the class to implement Comparable interface and the required method so that two Student objects can be compared directly based on their sID. (3) 2. You would also like to compare two Student objects directly by sgpa. Provide the proper class and method to enable this. (3) 3. Write the Java code for main() method to do the following: (4) a. Create an ArrayList and add to it 1 student object. You may assume more objects have been created and added to the Arraytist. b. Sort the ArrayList content by SID, then show the sorted ArrayList content. You may sort the data using either a Java library algorithm or your own sorting method. If you use your own, the sorting method code should be provided. C. Sort the Student ArrayList by sgpa using a Java library algorithm, then show the result. //FIXME: Provide / modify the Java code to complete task 1 \& 2 as required public class Student \{ private int sID: private String sname; private double sgpa; public Student(int id, String name, double gpa) \{ sID = id; sname = name; sgpa=gpa \} //FIXME: Provide the Java code for main() method to complete task 3a,b, and c as required public static void main(String[] arg) \{
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
