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:
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

Step by Step Solution

3.55 Rating (152 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Given below is the Robot class in C which include all the member functions given in the questi... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!