Question: Main.java Student.java + New 1- /** 2 * @author YOUR NAME HERE 3 */ 4 5- import java.util.ArrayList; 6 import java.util.Arrays; 7 import java.util.Collections; 8

 Main.java Student.java + New 1- /** 2 * @author YOUR NAMEHERE 3 */ 4 5- import java.util.ArrayList; 6 import java.util.Arrays; 7 importjava.util.Collections; 8 import java.util.Comparator; 9 10 - public class Main { 11-

Main.java Student.java + New 1- /** 2 * @author YOUR NAME HERE 3 */ 4 5- import java.util.ArrayList; 6 import java.util.Arrays; 7 import java.util.Collections; 8 import java.util.Comparator; 9 10 - public class Main { 11- public static void main(String[] args) { 12 Student[] array = new Student[6]; 13 14 array[0] = new Student("Linda", 3); 15 array[1] = new Student("Aaron", 4); 16 array[2] = new Student("Jane", 4); 17 array[3] = new Student ("Zac", 1); 18 array[4] = new Student("Edward", 3); 19 array[5] = new Student("Heather", 3); 20 21 //TODO: Add Code Below to sort the array 22 23 // -Your code ends here-------- 24 25 System.out.println("The students in the order of GPA and then of name:"); 26 for (Student x: array) { 27 System.out.println(x); 28 29 30 } 31 TODOS: (1) Make Student class a Comparable class (2) Add code in Main.java to sort. Your program should display the following: Student: Zac 1 Student: Edward 2 Student: Heather 2 Student: Linda 3 Student: Aaron 4 Student: Jane 4 Main.java Student.java + New 1 /* TODO 1: Make the class Comparable */ 2. public class Student { 3 private String name; 4 private int classification; 5 6 public Student(String name, int classification) { 7 this.name = name; 8 this.classification = classification; 9 } 10 11 - public String getName() { 12 return name; 13 } 14 15 - public int getclassification() { 16 return classification; 17 } 18 19 @Override 20- public String toString() { 21 return String.format("Student: %s %d", name, classification); 22 } 23 24

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 Databases Questions!