001package headfirst.proxy.gumball;
002
003@SuppressWarnings("serial")
004public class NoQuarterState implements State {
005        transient GumballMachine gumballMachine;
006
007        public NoQuarterState(GumballMachine gumballMachine) {
008                this.gumballMachine = gumballMachine;
009        }
010
011        public void insertQuarter() {
012                System.out.println("You inserted a quarter");
013                gumballMachine.setState(gumballMachine.getHasQuarterState());
014        }
015
016        public void ejectQuarter() {
017                System.out.println("You haven't inserted a quarter");
018        }
019
020        public void turnCrank() {
021                System.out.println("You turned, but there's no quarter");
022        }
023
024        public void dispense() {
025                System.out.println("You need to pay first");
026        }
027
028        public String toString() {
029                return "waiting for quarter";
030        }
031}