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