bethrobson / Head-First-Design-Patterns

Code for Head First Design Patterns book (2020)
3.15k stars 1.92k forks source link

A mistake of HasQuarterState.java in gumballstate and gumballstatewinner #34

Open newryu opened 2 years ago

newryu commented 2 years ago

state\gumball\GumballMachine.java Line 75: "No gumball dispensed" should be "You need to turn the crank"

state\gumballstate\HasQuarterState.java Line 27: "No gumball dispensed" should be "You need to turn the crank"

state\gumballstatewinner\HasQuarterState.java Line 33: "No gumball dispensed" should be "You need to turn the crank"

Just check Page 387 in the book, the dispense method when state is HAS_QUARTER

else if (state == HAS_QUARTER) {System.out.println("You need to turn the crank");}

the following warning messages of dispense method when the state is HAS_QUARTER in Chapter 10 need to be the same.

So the message "No gumball dispensed" of HAS_QUARTER state on Page 400, Page 410, Page 422 should be "You need to turn the crank".