Die.java
1    
2    package chance;
3    
4    public class Die {
5        //The Instance Variables
6    
7        private int order;
8        private int top;
9    
10       //The Constructors
11       public Die(){
12           order = 6;
13           top = (int) ((Math.random() * 6) + 1);
14       }
15   
16       public Die(int nrOfSides){
17           order = nrOfSides;
18           top = (int) ((Math.random() * nrOfSides) + 1);
19       }
20   
21       //The Methods
22       public int top(){
23           return top;
24       }
25   
26       public void roll(){
27           top = (int) ((Math.random() * order) + 1);
28       }
29   }
30   
31   
32