Question: I mostly need help with step 1 I'm unsure on how to do this //Main Class import java.util.Random; class Main { public static void main(String[]

 I mostly need help with step 1 I'm unsure on how

I mostly need help with step 1 I'm unsure on how to do this

//Main Class

import java.util.Random; class Main { public static void main(String[] args) { // create instance of Random class Random rand = new Random(); Student studentArray1[]= new Student[20]; Student studentArray2[]= new Student[20]; for(int i=0; i

//Student Class

public class Student implements Comparable{ private int IdNumber; public Student(int id_passed) { IdNumber=id_passed; } public int compareTo(Student objectCompare) { //IMPLEMENT return 0; } public String toString() { return "student: "+IdNumber; } }

Look through all the code, notice that there's a function that prints out the array defined in the bottom of the code and to String defined for you in Student and another function called compare To you must implement 3 things to implement First implement comapre To in Student Then Implement the two functions at the bottom to sort this array-- bubble sort and insertion sort Step 1) Implement compare To in Student.java if I do a.toCompare(b) if a>b we should return 1 if a==b we should return 0 and if a

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!