-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBox.java
More file actions
63 lines (46 loc) · 1008 Bytes
/
Box.java
File metadata and controls
63 lines (46 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package connectfour;
public class Box{
//Variables and collections
private boolean empty;
private int num;
private Disc theDisc;
//Constructors
public Box(int number) {
setNum(number);
setEmpty(true);
}//end Constructor
//Getters and setters
public int getNum() {
return this.num;
}
public void setNum(int num) {
this.num = num;
}
public boolean getEmpty() {
return this.empty;
}
public void setEmpty(boolean empty) {
this.empty = empty;
}
//end getters and setters
//addDisc method
public void addDisc(Disc theDisc) {
this.theDisc = theDisc;
setEmpty(false);
}//end addDisc
//returnString method
/**
*
* @return
*/
@Override
public String toString () {
String output;
if (this.empty == true) {
output = " (__________) ";
} else {
output = this.theDisc.getColour();
}
return output;
}// end returnString
}