public interface Player
{
/** Return an integer that represents a move in a game. */
int getMove();
/** Display the status of the game for this Player after
* implementing the next move. */
void updateDisplay();
}
public class HumanPlayer implements Player
{
private String name;
//Constructors not shown ...
//Code to implement getMove and updateDisplay not shown ...
public String getName()
{ /* implementation not shown */ }
}
public class ExpertPlayer extends HumanPlayer
{
private int rating;
//Constructors not shown ...
public int compareTo(ExpertPlayer expert)
{ /* implementation not shown */ }
}
Which of the following is correct implementation code for the compareTo method in the ExpertPlayer class?
I) if (rating == expert.rating)
return 0;
else if (rating < expert.rating)
return -1;
else
return 1;
II) return rating - expert.rating;
III) if (getName().equals(expert.getName()))
return 0;
else if (getName().compareTo(expert.getName()) < 0)
return -1;
else
return 1;
(A) I only
(B) II only
(C) III only
(D) I and II only
(E) I, II, and III