RedRobot and BlueRobot are
children of UpAndDownRobot.
a) Create the UpAndDownRobot so that it contains a variable called
spacesMove(d). This variable will keeps track of how many spaces an
UpAndDownRobot moves.
b) Create RedRobot. It starts out with the colour black. As it moves each space it
become more red. (Each space makes it more red by 15 units.) RedRobot
will need to override the move() method to keep
track of the number of spaces each has moved.
It will also need a mutator method that will adjust the colour.
c) Create BlueRobot. It starts out with the colour black. As it moves each space it
become more blue. (Each space makes it more blue by 15 units.) BlueRobot
will need to override the move() method to keep
track of the number of spaces each has moved.
It will also need a mutator method that will adjust the colour.
d) Create a test class that will use the city file TwinPeaks.txt. One robot
is to start at avenue 1, street 5 and a second robot is to start at avenue
11, street 5.
The first robot (RedRobot) is climb over the hill and pick up all the
Things.
Move RedRobot to the intersection of the second robot (BlueRobot) and
drop all of the things.
BlueRobot, the
second robot, will take all the Things dropped by the first robot.
The second
robot will climb over the second hill and drop Things at each step, as it
goes. As it moves it become more blue.
Test your program thoroughly. Document task code and new robot class
properly.
Do NOT hand in your work unless other instructions were given.
|