/home/sjenks/NetBeansProjects/CS1/src/chance/Die.java |
1
2
3
4
5
6 package chance;
7
8
9
10 @author
11
12 public class Die {
13
14
15
16 private int order;
17 private int top;
18
19
20 public Die(){
21 order = 6;
22 top = (int) ((Math.random() * 6 ) + 1);
23 }
24
25 public Die(int nrOfSides){
26 order= nrOfSides;
27 top= (int) ( ( Math.random() + nrOfSides ) + 1);
28 }
29
30
31
32 public int top(){
33 return top;
34
35 }
36 public void roll(){
37 top = (int ) ( ( Math.random() * order) + 1);
38
39 }
40
41
42 @param args
43
44 public static void main(String[] args) {
45
46 }
47
48 }
49