candy
Class GumballMachine

java.lang.Object
  extended bycandy.GumballMachine
All Implemented Interfaces:
CandyMachine

public class GumballMachine
extends java.lang.Object
implements CandyMachine

A machine that dispenses gumballs.

Version:
1.0 of August 2004
Author:
Samuel A. Rebelsky

Constructor Summary
GumballMachine()
          Build a new Gumball machine with the default number of balls.
 
Method Summary
 java.lang.String get()
          Get a piece of candy.
 boolean isEmpty()
          Determine if the jar is empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GumballMachine

public GumballMachine()
Build a new Gumball machine with the default number of balls.

Method Detail

get

public java.lang.String get()
                     throws CandyMachineException
Get a piece of candy.

Specified by:
get in interface CandyMachine
Throws:
CandyMachineException - If unable to return a piece of candy (e.g., if empty).

isEmpty

public boolean isEmpty()
Determine if the jar is empty.

Specified by:
isEmpty in interface CandyMachine