Question: Using the state pattern, you have to implement a robot that can; walk, walk slowly, walk fast, and cook based on an action provided by

Using the state pattern, you have to implement a robot that can; walk, walk slowly, walk fast, and cook based on an action provided by the user. In your design take the following into consideration: 1. The robot is considered ready after the user switched it on. 2. The robot can start cooking after walking. 3. The robot state can go from walk to walk slowly to walk fast based on input from use 4. The robot goes off after finishing the task (either walking slow, walking fast or cooking) or the user explicitly switch it off. Q1) (2 points) Draw the state diagram that shows all possible states and transitions? Q2) (2) Write code of the State Interface? Q3) (6 points) Write the implementation of the Robot class; most important things are the states declaration, the constructor, a function to return robot state
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
