Lab 7
The following exercises are to be completed during lab class. If you do
not have time to finish during lab, they must be completed before the beginning
of the following lab session. You will turn in the lab gradesheet
at the beginning of the following lab.
Before beginning the exercises, copy this lab's folder from the T: drive to
your H: drive.
-
Create a PatternBot that has a layTriangle method.
layTriangle will take a single integer parameter specifying the size (height)
of the triangle. When layTriangle is called, the PatternBot should be standing
facing east with a wall immediately behind him. The wall should continue south
for at least as many intersections as the size of the triangle (and may be
longer). When layTriangle is called with 5, the PatternBot will put things down
in the following pattern (*s represent Things and are placed on consecutive
intersections):
[*
[**
[***
[****
[*****
The PatternBot should always start with sufficient Things in his backpack to
complete the triangle .
Write a TestPatternBot.java file with a main to test your
PatternBot. Submit both PatternBot.java and your TestPatternBot.java in your
zip file.
Extra credit: Make your PatternBot lay his triangle
efficiently, starting alternating lines from the west, instead of the east.
-
Complete 5.14 on page 267 of your textbook.
Write a TestEscape.java file with a main to test
your Houdini class. Submit both Houdini.java and TestEscape.java in your
zip file. You may choose to create an additional class to help test your
robot -- if so, include it in your submission.
Use the windows zip utility to zip all required files into a single zip folder.
Submit the single zip folder to your lab section under project #7 using Web
Submit.
NOTE: Do NOT put your files into a folder to be zipped as this will make grading
more complicated. Simply select the necessary .java files, right click, choose
Send To = > Compressed (zipped) Folder.