/home/rkanin/NetBeansProjects/CS1/src/chance/Die.java
 1 /*
 2  * To change this license header, choose License Headers in Project Properties.
 3  * To change this template file, choose Tools | Templates
 4  * and open the template in the editor.
 5  */
 6 package chance;
 7 
 8 /**
 9  *
10  * @author rkanin
11  */
12 public class Die {
13     // THE INTACNE VARAIBLES(STATE)
14     
15     private int order;
16     private int top;
17     
18     // THE CONSTRUCTORS
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     // The Methods (BEHAVIOR)
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