Imagine you are creating a survival game. The main character roams an uninhabited island in search of food. The character may be in either of the two states, hungry or satiated, and will react to different actions according to his or her current state.
The template provides a part of the State pattern implementation that already defines the transitions between the states. Your task is to complete the code of the Hungry and Full classes. The following methods must do the following:
onFindFoodmust printFound some great foodif the character is hungry orFound some foodif the character is satiated.onEatmust printDeliciousif the character is hungry orWon't eat it right nowis the character is satiated.reportStatemust printI'm hungryif the character is hungry orI'm fullif the character is satiated.
See the examples.