Using the state pattern, you have to implement a robot that can; walk, walk slowly, walk fast,
Fantastic news! We've Found the answer you've been seeking!
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 the user. In your design take the following into consideration:
The robot is considered ready after the user switched it on.
The robot can start cooking after walking.
The robot state can go from walk to walk slowly to walk fast based on input from user
The robot goes off after finishing the task (either walking slow, walking fast or cooking) or the user explicitly switch it off.
Draw the state diagram that shows all possible states and transitions?
Write code of the State Interface?
Write the implementation of the Robot class; most important things are the states declaration, the constructor, a function to return robot state
Related Book For
Posted Date: