For the questions below, consider a class called ChessPiece. This class has two instance data, String type and int player. The variable type will store "King", "Queen", "Bishop", etc and the int player will store 0 or 1 depending on whose piece it is. We wish to implement Comparable for the ChessPiece class. Assume that, the current ChessPiece is compared to a ChessPiece passed as a parameter. Pieces are ordered as follows: "Pawn" is a lesser piece to a "Knight" and a "Bishop", "Knight" and "Bishop" are equivalent for this example, both are lesser pieces to a "Rook" which is a lesser piece to a "Queen" which is a lesser piece to a "King."22) Which of the following method headers would properly define the method neededto make this class Comparable?
A) public boolean comparable (Object cp)
B) public int comparable (Object cp)
C) public int compareTo (Object cp)
D) public int compare To ()
E) public boolean compareTo (Object cp)
+4
Answers (1)
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “For the questions below, consider a class called ChessPiece. This class has two instance data, String type and int player. The variable ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Home » Computers & Technology » For the questions below, consider a class called ChessPiece. This class has two instance data, String type and int player.