/** * Class that generates random responses to user questions. * @author Dave Reed * @version 10/14/06 */ public class DecisionMaker { private static final int NUM_CHOICES = 2; private static Die die = new Die(DecisionMaker.NUM_CHOICES); /** * Constructs a DecisionMaker that can chose between "YES" and "NO" */ public DecisionMaker() { } /** * Returns a randomly selected answer * @param question the user's question (which is actually ignored) * @return the response to that question ("YES" or "NO") */ public String getAnswer(String question) { int roll = DecisionMaker.die.roll(); if (roll == 1) { return "YES"; } else { return "NO"; } } }