Die.java
/* Model a die in term of two properties 
* in order the number of faces 
* top the value of the top face 
*/
package chance;

public class Die {
    // the instance vairable (state)
    private int order;
    private int top;

    //the constructors
    public Die(){
        order = 6;
        top = (int)((Math.random()*6)+1);
    }
    public Die (int nrofsides){
        order = nrofsides;
        top = (int) ((Math.random()*nrofsides)+1);
    }
    // the methods (behavior)
    public int top(){
        return top;
    }
    public void roll(){
        top=(int) ((Math.random()*order)+1);
    }
}