modify gumballmachine with 'state pattern'