001package headfirst.state.gumballstatewinner; 002 003public class SoldOutState implements State { 004 GumballMachine gumballMachine; 005 006 public SoldOutState(GumballMachine gumballMachine) { 007 this.gumballMachine = gumballMachine; 008 } 009 010 public void insertQuarter() { 011 System.out.println("You can't insert a quarter, the machine is sold out"); 012 } 013 014 public void ejectQuarter() { 015 System.out.println("You can't eject, you haven't inserted a quarter yet"); 016 } 017 018 public void turnCrank() { 019 System.out.println("You turned, but there are no gumballs"); 020 } 021 022 public void dispense() { 023 System.out.println("No gumball dispensed"); 024 } 025 026 public String toString() { 027 return "sold out"; 028 } 029}