Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Create a class CRobot that creates a robot defined by O The following characteristics o Type OSN: Serial number o Orientation Status (In service,

image text in transcribed

1. Create a class CRobot that creates a robot defined by O The following characteristics o Type OSN: Serial number o Orientation Status (In service, Out of service, Under repair) The following methods Constructor: Robot() or Robot(type, sn) getType(): returns the type of robot o getsN(): returns the robot's serial number .getOrientation (): returns the orientation of the robot o getState(): returns the robot's status setOrientation(...): defines the orientation of the robot setState(...): defines the state of the robot turn(...): turns the robot a 1/4 turn display(): display robot information orientation is an integer attribute that designates the orientation of the robot. 1: NORTH, 2: EAST, 3: SOUTH, 4: WEST turn turns the robot, by default to the left display displays the status, orientation, serial number and type of the robot. Instantiate this class on an array of 4 robots using the set of functions for at least one of them. The following is a sample of Run (input/output) Serial number : 1 State : False # Test/Run Orientation : 1 # Create a list of Robots Type : X-Man robot list_robot = [] Serial number : 2 State : False for i in range (1,5): Orientation : 1 robot = Robot("X-Man robot", i) Type : X-Man robot list_robot.append (robot) Serial number : 3 # State : False for i in range(0,4): Orientation : 1 list_robot[i].display ( ) Type : X-Man robot Serial number: 4 list_robot[i].setState(True) State : False list_robot[i].setOrientation(i+1) Orientation : 1 print (" --- Update of parameters --- ") Type : X-Man robot for i in range (0,4): list_robot[i].display() Update of parameters 1 2 3 4 5 7 9 10 11 12 13 14 Serial number: 1 State : True Orientation : 1 Type : X-Man robot Serial number : 2 State : True Orientation : 2 Type : X-Man robot Serial number : 3 State : True Orientation : 3 Type : X-Man robot Serial number : 4 State : True Orientation : 4 Type : X-Man robot

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions

Question

Describe the accounting treatment of reacquired shares.

Answered: 1 week ago

Question

Describe the types of power that effective leaders employ

Answered: 1 week ago

Question

Describe how leadership styles should be adapted to the situation

Answered: 1 week ago