![]() |
Problem Set 1
|
Download the ps1_programs folder from the cs111 server by using the cs111d account and the passwd provided in lecture. Rename this folder Wendy's ps1, except, of course, you should replace Wendy with some word that uniquely identifies you. (If you see somebody else's folder on the Desktop, drag it to the trash and empty the trash. It would be a violation of the Honor Code to open the folder.) Make your modifications to the Writing.java and Rings.java files to solve the 2 problems defined in the two tasks below. The problems are intended to give you practice writing simple Java code. Both problems use the BuggleWorld microworld you have been studying in lecture.
Save the modified Writing.java and Rings.java files in the ps1_programs folder to be turned into your drop folder. Turn in a hardcopy of the modified Rings.java and Writing.java files.
Upload the entire ps1_programs folder containing the completed source code into your ps1 drop folder on the cs111 server.
When submitting your hardcopies, we ask that you turn in only one package of materials. Please staple your files together with a cover page, and submit your hardcopy package by sliding it under the door of Elena's office (E127, in Minifocus).
IMPORTANT NOTES:
In lecture and lab, we have learned that in BuggleWorld, buggles can be used to make patterns or write letters within a grid. Below, a single buggle has written the name "JAVA" in multiple colors:
.
Your assignment:
In your ps1 folder there is a file, Writing.java, which contains a Java program to create a single buggle ellie. Add code to the run method to write the name "JAVA" as shown above.
You must conform to the following rules:
In BuggleWorld, the buggles regularly hold competitions in which they run the hurdles or traverse obstacle courses. Because they enjoy these competitions so much, they have decided to hold the first Buggle Olympics. To prepare for the big event, they have decided they need an appropriate symbol. They like the idea of interlocking rings, but due to the constraints of BuggleWorld, their rings have to be squares instead of circles. They have designed the following logo for their olympics:
Five buggles--becky, bobby, bertie, billy and benny--have agreed to help out in drawing the rings. becky wants to draw the red ring, bobby the yellow ring, bertie the blue ring, billy the cyan ring and benny the magenta ring. Each would prefer to draw only in one color and not change colors in the middle of their ring. Furthermore, they would prefer not to have to put their brushes up and down while drawing their rings. They have asked you to help them choreograph their movements so that the rings get drawn the correct way, with each ring overlapping the others as shown above.
Your assignment:
Before you start working on this problem, move the file Rings.html
above Writing.html
in Link Order in your project. This
way when you run the project, the Rings program runs.
The file "Rings.java" contains the initial set-up for drawing the olympic rings. becky, bobby, bertie, billy and benny are all in the appropriate starting position and are the appropriate color. Fill in the java code to move each buggle around a 7 x 7 square, so that the rings overlap each other as shown.
You must conform to the following rules: