
public class Coin {
    private int numFlips;

    public Coin() {
        this.numFlips = 0;
    }

    public String flip() {
        this.numFlips = this.numFlips + 1;
        if (Math.random() < 0.5) {
            return "HEADS";
        }
        else {
            return "TAILS";
        }
    }
    
    public int getNumberOfFlips() {
        return this.numFlips;
    }
}
