Please add comments and javadoc, make sure is code is written correctly, bracket
ID: 3902272 • Letter: P
Question
Please add comments and javadoc, make sure is code is written correctly, bracket, semi colans etc. Thanks
public class Cell
{
// Displays 'B' for the black disk player.
public static final char BLACK = 'B';
// Displays 'W' for the white disk player.
public static final char WHITE = 'W';
// Displays '*' for the possible moves available.
public static final char CANSELECT = '*';
// If the cell is empty or not.
public boolean empty;
// If the cell can be selected or not.
public boolean canselect;
// empty = -1 , white = 0 , black = 1
public int value;
public Cell()
{
this.empty = true;
this.value = -1;
}
public boolean isEmpty()
{
return this.empty;
}
public int getPlayer()
{
return this.value;
}
public void placeChip(int player)
{
this.empty = false;
this.value = player;
}
public void changeChip()
{
placeChip((value + 1) % 2);
}
public void setSelect()
{
this.canselect = true;
}
public boolean canSelect()
{
return this.canselect;
}
public void unselect()
{
this.canselect = false;
}
public void display()
{
// If cell empty.
if (this.isEmpty())
{
// If cell can be selected.
if (this.canselect)
System.out.print("[ " + CANSELECT + " ]"); // Print "*."
// Print empty space.
else
System.out.print("[ " + " " + " ]");
}
else
{
char content = BLACK;
if (this.value == 0)
content = WHITE;
System.out.print("[ " + content + " ]"); // For black "B" & for white "W."
}
}
}
Explanation / Answer
I have java doc and checked for syntax error but not any :
you can generate javadoc by below syntax:
javadoc Cell.java
//Please so let me know if u have any concern...
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.