![]() Graphic by Keith Ohlfs |
|
Note: The assigned readings which are relevant to this problem set are:
There are 3 pieces to this problem set: the prelaboratory assignment, the laboratory assignment and the homework assignment. You are required to do all three parts. We recommend that you do the prelaboratory assignment before your lab section, the laboratory assignment during your lab section and the homework assignment after completing the prelab and lab assignments.
Prelab Assignment: Save your modified CS111_BuggleWorld.java file in the same ps3_Buggles folder you downloaded (you are NOT required to rename the java and html files for this assignment, as you did in assignment 2). You will be further modifying the same file for your laboratory a ssignment, so, this week, you will not need to turn in any items separately for the prelab.
Laboratory Assignment: Save your modified CS111_BuggleWorld.java (which includes the prelab and laboratory solution) in the ps3_Buggles folder. Also, turn in a hardcopy of your CS111_BuggleWorld.java file.
Homework Assignment: Save your modified Rug_BuggleWorld.java file in the same ps3_Buggles folder. Also, turn in a hardcopy of your Rug_BuggleWorld.java file.
Put the ps3_Buggles folder containing the completed assignments into your ps3 drop folder on the cs111 server.
Turn in only one package of hardcopy materials. Staple your files together with the cover page, and submit your hardcopy package by placing it in the box outside of Jennifer's office (E104, directly across from E101).
Reminders
To begin, download the folder ps3_Buggles from the download Directory for CS111. This folder contains three java source files (BuggleWorld.java,CS111_BuggleWorld.java, and Rug_BuggleWorld.java), two html files (CS111_BuggleWorld.html and Rug_BuggleWorld.html), various class files, and the project file, ps3_Buggles.proj.
Open the ps3_Buggles.proj project file by double clicking on it, to start the Symantec Cafe Application. The project window should display the names of the three java source files and the two html files.
Open the CS111_BuggleWorld.java file by double-clicking on it from the project window. Your job is to add the code for the writeC(Color letter_color) method, which is used by a letterBuggle (a new class of objects which extends the Buggle class) named fred to write a letter "C" in the CS111_BuggleWorld grid, in a color specified by the parameter letter_color .
The following are the rules you must follow:
Follow the same rules as for the letterC() method from prelab to write letterS() and letter1() methods. Each should take a color paramter, as well. To test your code, change the method invocation in the run()method from letterC(Color.red) to letterS(Color.blue) .
Then, do the same for letter1(Color.black) .
Notice how easy it was to do the "111" part! Fred is so excited by finally being able to spell the course name that he would like a method to do so any time he likes. So, create another method in the letterBuggle class which can write "CS111", and call the new method CS111() . Will it have any parameters?
"
You will need to come up with a way to turn and change your heading at each corner of the grid. Let's work on this together.
Here is an example of a rug they created:
The buggles are great designers, but, unfortunately, they don't know much about manufacturing. It takes so long to hand-drop the bagels individually that it's impossible to make any money. Luckily for them, there is a way to automate the production of the rugs. As it turns out, the design shown above can be produced using just 4 different 3x3 grids of bagel patterns:
It is also helpful to realize that the rug design consists of three concentric rings of 3x3 grids, as indicated by the heavy black outines shown below (the lighter black lines demarcate the 3x3 grid patterns):
The ps3_Buggles folder contains a file named "Rug_BuggleWorld.java". This file contains the initial set-up for creating the rug shown above. becky, bobby, and bertie have hired a RugBuggle (another new class of objects which extends the Buggle class) named weaver to produce the rugs. The file has stubs for the methods which you need to write to accomplish the task. You should add your code to this file, but you should not remove any the existing code. You must observe the following constraints: