/** The RollDice class relies on the Die class that we already wrote for * another program (DiceGame). All we need here is the ability to roll * 2 dice and return their sum. Thus, for this program it was not necessary * to change Die.java. */ public class RollDice implements Measureable { private Die d; private int sum; // roll 2 dice and then sleep for 5 milliseconds // to reset random number generator public RollDice() throws InterruptedException { d = new Die(6); sum = d.roll() + d.roll(); Thread.sleep(5); } public double getValue() { // sum = d.roll() + d.roll(); return (double) sum; } public String toString() { return "==> " + sum + " <=="; } }