Graphic by Keith Ohlfs

CS111, Wellesley College, Fall 1999

Problem Set 2

Due: Friday, September 24 by 4:00 p.m.

[CS111 Home Page] [Syllabus] [Students] [Lecture Notes] [Assignments] [Programs] [Documentation] [Software Installation] [FAQ] [CS Dept.] [CWIS]

Note: The assigned readings which are relevant to this problem set are:

About this Problem Set

Read the announcements page for important information regarding problem sets in general!

This problem set involves writing methods and using them toward making a large task easier. The labs will review methods and method writing, as well as provide examples which will help with the homework assignment.

How to turn in this Problem Set

Save your modified Rug_BuggleWorld.java file in the same ps2_programs folder. Also, turn in a hardcopy of your Rug_BuggleWorld.java file.

Put the ps2_programs folder containing the completed assignment into your ps2 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

Getting started

To begin, download the folder ps2_programs from the download Directory for CS111. This folder contains two java source files (BuggleWorld.java and Rug_BuggleWorld.java), an html file (Rug_BuggleWorld.html) and the project file (ps2_Buggles.proj).

Open the ps2_Buggles.proj project file by double clicking on it, to start the Symantec Cafe Application. The project window should display the names of the two java source files and the html file.

Homework Assignment

The Buggle Bagel Ruggle Company

The buggles from Problem Set 1, becky, bobby, bertie, billy and benny, had the foresight to copyright their Buggle Olympic Symbol. As a result, they made a killing on the use of the logo for Buggles Olympics memorabilia and merchandise. So, they decided to invest in a rug-making enterprise: The Buggle Bagel Ruggle Company, which designs and weaves rugs made by dropping bagels in interesting ways on a BuggleWorld grid.

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):

Your assignment:

The problem is to come up with a way to take advantage of the rug structure to produce the rug using methods.

The ps2_programs folder contains a file named "Rug_BuggleWorld.java". This file contains the initial set-up for creating the rug shown above. becky, bobby, bertie, benny and billy 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:

  1. You should use a single RugBuggle for the entire rug (weaver, who has already been created in the file).
  2. You may not, and do not need to, use the setPosition() method. You can use any of the other Buggle methods.
  3. You should draw the colors and bagels exactly as shown in the rug.

Helpful Hints:

Have fun!