Class Die

public class Die
extends java.lang.Object

Die class simulates a six-sided die object, with the numbers 1-6 (inclusive, one number on each of its sides).


Field Summary
private  int face
           
 
Constructor Summary
Die()
          Constructs a new die object, initializing face to a random value.
 
Method Summary
 int getFace()
          Gets the current face value of the die.
 int roll()
          Simulates the roll of the die.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

face

private int face
face values range from 1 to 6.
Constructor Detail

Die

public Die()
Constructs a new die object, initializing face to a random value (1-6).

Method Detail

roll

public int roll()
Simulates the roll of the die by setting the face to a new integer in the range 1-6.
Returns:
The new face value of the die

getFace

public int getFace()
Gets the current face value of the die.

Returns:
The current face value of the die (ranges 1-6).