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