15-100:
Introductory/Intermediate Programming
(Section F) |
Fall 2006 |
Relevant Reading:
Assignment: (worth 10 exercise points) Get the ex10-13.zip file. Use the files in this folder as your basis for this assignment. Your tasks: You are to create a class of robots called HwRobot, that have a name, that is specified when the robot is constructed and can be accessed via a method called getName. HWRobots also keep track of how many walls they encounter. This information can be accessed via a method called getHowManyWalls(). HwRobots are assumed to start with 100 beepers unless specified otherwise. HwRobots are assumed to start at (1,1) unless specified otherwise. HwRobots also have a method called moveOrTurnRight() that has the robot move once if the frontIsClear, but turnRight otherwise. Look at the program in Application.java. Create the class HwRobot such that the program does what it is supposed to. walls1.txt should produce: Huey encountered a wall 0 times. Dewey encountered a wall 9 times. Louie encountered a wall 0 times. walls2.txt should produce: Huey encountered a wall 3 times. Dewey encountered a wall 5 times. Louie encountered a wall 9 times. walls3.txt should produce: Huey encountered a wall 0 times. Dewey encountered a wall 0 times. Louie encountered a wall 2 times. walls4.txt should produce: Huey encountered a wall 3 times. Dewey encountered a wall 3 times. Louie encountered a wall 11 times. walls5.txt should produce: Huey encountered a wall 0 times. Dewey encountered a wall 5 times. Louie encountered a wall 21 times. NOTES:
Handin:
|