/**
 * Class that generates a random yes/no response to a user's question.
 *   @author Dave Reed
 *   @version 1/20/13
 */
public class DecisionMaker {
    private int expectedYesPercentage;
    
    /** 
     * Constructs an object that chooses between "YES" and "NO" (with specified probabilities).
     *   @param yesP the expected probability that the answer is "YES"
     */
    public DecisionMaker(int yesP) {
        this.expectedYesPercentage = yesP;
    }
        
    /**
     * 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) {
        if (Math.random()*100 < this.expectedYesPercentage) {
            return "YES";
        }
        else {
            return "NO";
        }
    }
 }