|
|
Karel 18Complete the following in class or for homework. Do NOT hand in your work unless other instructions were given. Create a new class TurnCounterRobot which is a child of the RobotSE class. This new robot will have two instance variables, one that counts the number of right turns and one that counts the number of left turns. Override the turnRight method so that it will add 1 to the number of right turns instance variable before it turns. Override the turnLeft method to add 1 to the number of left turns instance variable and then turn. Add accessor methods for the number of right turns instance variable and for the number of left turns instance variable. Test your robot using the Rome.txt city file. Your tester code should:
|
| ||||