* Sort Student array descending based on GPA using MERGE sort. Sorting will be done in...

80.2K

Verified Solution

Question

Programming

* Sort Student array descending based on GPA using MERGE sort.Sorting will be done in place.

*

* @param students array to be sorted, can be empty, but cannotbe null

*/

public static void sortGPA(Student[] students)

{

// TODO: implement this

}

Student class:

public class Student extends Person { private double GPA; public Student(String lastName, String firstName, double gpa) {  super(lastName, firstName);  this.GPA = gpa; } public double getGPA() {  return GPA; } @Override public boolean equals(Object o) {  if (this == o) {   return true;  }  if (o == null || getClass() != o.getClass()) {   return false;  }  if (!super.equals(o)) {   return false;  }  Student student = (Student) o;  return Double.compare(student.GPA, GPA) == 0; } @Override public String toString() {  return \"Student{\" + super.toString() + \";\" +    \"GPA=\" + GPA +    '}'; }}

Answer & Explanation Solved by verified expert
4.3 Ratings (707 Votes)
Implementation in JAVAimport javautilScannerpublic class Studentsort statically defined Scanner Student arrayandsize static Scanner s new ScannerSystemin static Student arr new Student10 static int size0 driver    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students