Repository navigation
Expand file tree
/
Copy pathMyDice.java
More file actions
87 lines (73 loc) · 2.12 KB
/
Copy pathMyDice.java
File metadata and controls
87 lines (73 loc) · 2.12 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
public class MyDice {
public void rollDice(int numberOfRolls){
for(int i = 0; i < numberOfRolls; i ++){
int roll = (int)(Math.random() * 6 + 1);
switch(roll){
case 1:
this.OnesCount++;
break;
case 2:
this.TwosCount++;
break;
case 3:
this.ThreesCount++;
break;
case 4:
this.FoursCount++;
break;
case 5:
this.FivesCount++;
break;
case 6:
this.SixesCount++;
break;
}
}
}
// <editor-fold defaultstate="collapsed" desc="Getters and Setters">
public int getOnesCount() {
return OnesCount;
}
public void setOnesCount(int OnesCount) {
this.OnesCount = OnesCount;
}
public int getTwosCount() {
return TwosCount;
}
public void setTwosCount(int TwosCount) {
this.TwosCount = TwosCount;
}
public int getThreesCount() {
return ThreesCount;
}
public void setThreesCount(int ThreesCount) {
this.ThreesCount = ThreesCount;
}
public int getFoursCount() {
return FoursCount;
}
public void setFoursCount(int FoursCount) {
this.FoursCount = FoursCount;
}
public int getFivesCount() {
return FivesCount;
}
public void setFivesCount(int FivesCount) {
this.FivesCount = FivesCount;
}
public int getSixesCount() {
return SixesCount;
}
public void setSixesCount(int SixesCount) {
this.SixesCount = SixesCount;
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Fields">
private int OnesCount;
private int TwosCount;
private int ThreesCount;
private int FoursCount;
private int FivesCount;
private int SixesCount;
// </editor-fold>
}