15-100: Introductory/Intermediate Programming (Section F)
Fall 2006
Exercise   
10/13/2006
Count Walls
Due:  Thursday, October 19
8am

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:
  • Be sure to add appropriate documentation to your program.
  • You are permitted to talk with others in this section regarding how the program works.  However, you need to do the actual work yourself and understand the answer that you produce.


Handin:
  • Be sure to read the general handin instructions on the exercises page.
  • Rename the folder containing all of the files to be "lastname-firstname-100SectionLetter-countwalls".   For example, if I were in Section Z, I would rename my folder to be:  "McElfresh-Scott-100Z-countwalls"  (without the quotes).   
  • Create a zip file of this folder, with the same name as the folder (except with the .zip ending this time). Instructions for zipping can be found in the system and software handouts linked on the main course page.
  • Submit this file via the electronic handin.  If you have problems, contact me.