/**
 * Class that models a fair coin.
 *   @author Dave Reed
 *   @version 1/10/17
 */
public class Coin {
    private Die d2;

    /**
     * Constructs a coin.
     */
    public Coin() {
       this.d2 = new Die(2);
    }

    /**
     * Simulates a flip of the coin.
     *   @return either "HEADS" or "TAILS" (with equal probability)
     */
    public String flip() {
        if (this.d2.roll() == 1) {
            return "HEADS";
        }
        else {
            return "TAILS";
        }
    }
}
