
/**
 * Class that models an American-style roulette wheel (with numbers 1-36, 0, and 00).
 * 
 * @author Dave Reed
 * @version 2/20/10
 */
public class RouletteWheel {
    private Die roller;           // Die for simulating a wheel spin
    private int numSpins;         // number of spins so far

    /**
     * Constructor for objects of class RouletteWheel
     */
    public RouletteWheel() {
        roller = new Die(38);
        this.numSpins = 0;
    }

    /**
     * Simulates a single spin of the roulette wheel.
     *   @return the number obtained by the spin  
     *           (Note: both wheel slots 0 and 00 are returned as 0.)
     */
    public int spin() {
        int number = this.roller.roll();
        this.numSpins++;
        
        if (number > 36) {
            return 0;
        }
        else {
            return number;
        }
    }
    
    /**
     * Reports the number of times the wheel has been spun.
     *   @return the number of spins so far
     */
    public int getNumberOfSpins() {
        return this.numSpins;
    }
}
