/** * Class that can randomly choose between "yes" and "no" * @author Dave Reed * @version 10/4/09 */ public class Decider { private Die die; /** * Constructs a Decider object. */ public Decider() { this.die = new Die(2); } /** * Answers a yes/no type of question. * @param question the question being asked * @return either "YES" or "NO" */ public String decide(String question) { if (this.die.roll() == 1) { return "YES"; } else { return "NO"; } } }