Strategy 2
- 
Controlleris an interface with avoid doIt()method. Write the interface. - 
Write
DoubleDotclass implementing theControllerinterface that tells two robots to put a beeper and move.DoubleDotitself is not a robot. TheDoubleDotclass has to find out whichUrRobots in its constructor.public static void demo() { UrRobot x = new UrRobot(3,1,Directions.East,5); UrRobot y = new UrRobot(5,1,Directions.South,2); DoubleDot c = new DoubleDot(x,y); c.doIt(); // x puts a beeper and moves to (3,2) // y puts a beeper and moves to (4,1) } - 
The
BCclass is a kind ofUrRobotthat uses a Controller. These robots always start at street=7, avenue=3, with 10 beepers. The constructor should take in the direction and a Controller.When you tell a
BCrobot to move, it moves and applies thedoIt()method of the controller.