(Solved) : Pall 2009 2 Questions 2a 2c Involve Student Class Partially Defined Public Class Student I Q41359183 . . .

Pall 2009 2) Questions 2a-2c involve the Student class that is partially defined below: public class Student implements CompaPall 2009 2) Questions 2a-2c involve the Student class that is partially defined below: public class Student implements Comparable //data private String name; private int id; private double average; //constructors public Student() { //not shown public Student (String n, int i, double a) { //not shown //methods public int compareTo (Object other) { //parts a and b! //accessor methods getName(), getID), and getAverage () not // shown 1 /mutator methods setName(Strings), setAverage (double d), setID(int i) not shown. a) Write a method body for the compareTo method of the Student class that compares the average of Student objects. The method returns a positive integer if this object has a greater average than other, a negative integer if this object has a lesser average than other, and zero if they have the same average. public int compareTo (Object other) { average corp To C compare to tottererge); Show transcribed image text Pall 2009 2) Questions 2a-2c involve the Student class that is partially defined below: public class Student implements Comparable //data private String name; private int id; private double average; //constructors public Student() { //not shown public Student (String n, int i, double a) { //not shown //methods public int compareTo (Object other) { //parts a and b! //accessor methods getName(), getID), and getAverage () not // shown 1 /mutator methods setName(Strings), setAverage (double d), setID(int i) not shown. a) Write a method body for the compareTo method of the Student class that compares the average of Student objects. The method returns a positive integer if this object has a greater average than other, a negative integer if this object has a lesser average than other, and zero if they have the same average. public int compareTo (Object other) { average corp To C compare to tottererge);

Expert Answer


Answer to Pall 2009 2) Questions 2a-2c involve the Student class that is partially defined below: public class Student implements …