/* * SingleDie.java * * Copyright 2013 Thomas Reinhardt * * Description: This class represent a single Dice, which is an object * that essentially represents a "chance" integer in range from 1 * (the minimum) to n (which must be > 1). In addition to providing * a "face value," OneDie objects keep track of how many times * they have been "rolled." Note finally that this value is * "resettable" by the client of this class. * * Invariants: Objects of this class are created with a "face" * that is never less than 1 and never greater than "N_Faces", * which is some integer > 1. Newly created objects of this * class have a "count" of 0, meaning they have not been "rolled," * but do have a valid "face." * * SingleDie objects support: * (1) SingleDie( int number_of_faces ); This method creates * a SingleDie object; note its "face" will be an * integer between 1 and number_of_faces (inclusive). * (2) getFace() --Returns the value of this objects "face." * (3) roll() --May change the object's face ---depending upon * the results of internal logic. * (4) getCount() --Returns an integer >= 0 that tells its caller * how many times this particular object has been "rolled." * (5) reset() --Returns the number of times that this particular * SingleDie object had been rolled, but then resets the * roll count for this object to 0. * Overrides: * (1) toString() --SingleDie objects print themselves in a * meaningful way,. * * */ import java.util.Random; /* needed to generate random integers. */ public class SingleDie { // properties // constructor(s): // public interface: // overrides // private methods. // Unique entry point: public static void main (String args[]) { } }