/**
 * CS1101 Take-home Lab #3, Exercise 1: FortuneCookie.java
 * 
 * This FortuneCookie contains data members value and cookie.
 * Given a value, a corresponding cookie is assigned.
 * 
 * Discussion group: <fill in your group number here>
 */

class FortuneCookie {

    private static final String cookies[] = 
      {"Ideas are like children; there are none so wonderful as your own.",
       "A pleasant surprise is in store for you.",
       "Your many hidden talents will become obvious to those around you.",
       "Good luck is the result of good planning.",
       "A cheerful message is on its way to you.",
       "A well-aimed spear is worth three.",
       "Complete chores you'e been avoiding for some time.",
       "The last thing you want to be sorry for what you didn't do.",
       "A kind word will keep someone warm for years."};

    private int    value;
    private String cookie;

    // Constructor
    public FortuneCookie() {
        value = 0;
        cookie = "";
    }

    // Accessors: getValue() and getCookie()
    public int getValue() {
        return value;
    }

    public String getCookie() {
        return cookie;
    }

    // Mutators: setValue() and setCookie()
    public void setValue(int v) {
        value = v;

        // When a value is set, it makes sense to
        // determine the corresponding cookie and
        // set the cookie as well
        int answer = sumDigits();
        setCookie(cookies[answer-1]);
    }

    private void setCookie(String msg) {
        cookie = msg;
    }

    // fill in the missing method here
    
}


