Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Given below is the Robot class in C which include all the member functions given in the questi...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started