Die.java
1    package chance;
2    
3    public class Die
4            {
5        private int order;
6        private int top;
7        public Die() {
8            order = 6;
9            top = (int) ((Math.random() * 6) + 1);
10       }
11       public Die(int nrOfSides) {
12           order = nrOfSides;
13           top = (int) ((Math.random() * nrOfSides) + 1);
14       }
15       public int top() {
16           return top;
17       }
18       public void roll()
19       {
20           top = (int)((Math.random()* order) + 1);
21       }
22   
23   }
24