1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ankoles [38]
3 years ago
13

For the questions below, consider a class called ChessPiece. This class has two instance data, String type and int player. The v

ariable 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)
Computers and Technology
1 answer:
Marina86 [1]3 years ago
3 0

public boolean comparable(Object cp) headers would properly define the method neededto make this class Comparable.

A) public boolean comparable(Object cp)

<u>Explanation:</u>

Chesspieces is class is declaring in programming languages such c++ or python or java. Inside Chesspiece class declare with two variables names, First variable  data type is string which holds names chess board character such as “Queen”, “king” , “Bishop”, and other variable stores Boolean values false or true.

This program is meant for chess games. Moreover the class been compared zero or one on each character of chess  games.

To compare end user pass the parameter and get the Boolean value either false or true.

You might be interested in
Paths describe the location of folders and files on your computer. If you have saved your work to c:\documents, then your work h
swat32
The answer is D and it can also be C
3 0
3 years ago
Adjust list by normalizing When analyzing data sets, such as data for human heights or for human weights, a common step is to ad
finlep [7]

Answer:

I've implemented this program using python

userinput = int(input("Length: "))

mylist = []

mylist.append(userinput)

for i in range(1,userinput+1):

   userinp = int(input("Input: "))

   mylist.append(userinp)

smallval = mylist[1]

for i in range(1,len(mylist)):

   if smallval > mylist[i]:

       smallval = mylist[i]

for i in range(1,len(mylist)):

   mylist[i] = mylist[i] - smallval

for i in range(1,len(mylist)):

   print(mylist[i],end=' ')

Explanation:

I've added the full source program as an attachment where I used comments to explain difficult lines

4 0
3 years ago
Write a program that repeatedly shows the user a menu to select the shape form three main shapes or to print the shapes created
fomenos

Answer:

Explanation:

The following code is written in Python. It creates a program that keeps printing out a menu allowing the user to create shapes. These shapes are saved in an array called shapes. Once the user decides to exit, it prints all of the shapes in the array along with their total area. The output can be seen in the attached picture below. Due to technical difficulties, I have added the code as a txt file below.

3 0
2 years ago
Organisms that reproduce sexually​
weqwewe [10]

Sex glad is responsible

3 0
3 years ago
50 points please!!
MA_775_DIABLO [31]

Answer:

poopypoopypoopypoopy

6 0
3 years ago
Other questions:
  • Every node (except of the last node) in a singly linked list contains ____
    5·1 answer
  • How do i unblock website on my school computer
    7·2 answers
  • Jenis-jenis grafik bagi imej​
    10·1 answer
  • which kind of device does a computer need in order to provide information to a person or something else
    7·1 answer
  • Which of the following statements is used to terminate the program when closing the frame?
    5·1 answer
  • Write a program that reads students’ names followed by their test scores. The program should output each student’s name followed
    13·1 answer
  • How do i make spaces in python<br> To draw hello world
    15·1 answer
  • What is the component on the motherboard that confirms all devices are in working order once the computer is turned on?
    13·1 answer
  • Electronic evidence on computer storage media that is not visible to the average user is called​ ________.
    14·1 answer
  • Do you trust machine learning application?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!