Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
Chapter 11
MAPS
A Robot Monitoring System
• Each robot will have a unique name and a mode, which can be WORKING, IDLE or BROKEN. There are two sectors, A and B, in which a robot can be set to work. The following operations are required:
• addRobot: accepts the name of a new robot and records the fact that this robot has been added to the collection. Its mode is set to idle and it is therefore not allocated a sector to work in.
• removeRobot: accepts the name of a robot and records the removal of this robot from the system.
Operations requirements
• setToWork: accepts the name of a robot, that must currently be idle, and records the fact that it has been set to work in a given sector.
• finishWork: accepts the name of a robot, and records the fact that this robot has been removed from the sector and that its mode has been set to idle.
• needsRepair: as above but records its mode as broken.• fixed: accepts the name of a broken robot and records that
that its mode has been set to idle.• inSector: accepts a given sector and returns the names of
those robots in that sector.• numberToRepair: returns the number of broken robots.
Thanks