|
Use the concept of inheritance taught in class to create a child class
of the RobotSE, named RacerRobot. This robot is going to run a race with 3
hurdles. At each hurdle, the robot must jump over the hurdle (see the
diagram). The race will be exactly 6 strides long.
This child class should have a method called raceStride. The raceStride
method should move the robot forward when it can, otherwise jump over one
hurdle only when it must. The method jumpHurdle() can be a helper method
called by the raceStride method.
In jumping a hurdle, use helper methods named jumpUp and glideDown
(recall that helper methods are declared private, since they are only used
within the class itself).
Use the city file Athens.txt. Start your robot
at avenue 1, street 6 facing East, with no things in its backpack, as shown
(the robot is the red arrowhead). The robot will run the hurdle race by
calling the raceStride method 6 times.
Do NOT hand in your work unless other instructions were given.
|