CMSC110 (Introduction to Computing)

Fall 2010

Assignment#4

Due before start of class on Tuesday, October 5, 2010

First, read Chapters 1, 2, 3, 4. 5, 6, 7 & 8 from Shifman's text.

Task: Design a street light. You can design it anyway you like. You will model the street light using an object class as follows:

StreetLight light1, light2, light 3;


void setup() {
	size(_, _);
  smooth();
  light1 = new StreetLight(x, y, h);
  light2 = new StreetLight(...);
  light3 = new StreetLight(...);

}
 // end of setup


void draw() {
	background(255);
  
  // turn the light on or off
  light1.turnOn();
  light3.turnOff();
	...


} // end of draw


class StreetLight {
 void StreetLight(...) {
	...
 }


 void turnOn(...) {

	...
 }

   ...
}// end of class StreetLight

The focus should be on the use of classes to define the Streetlight object factory. You will need to draw the constructor, various operations for turning a given light on or off, drawing it, etc. When turned on, the display of the street light should visibly change.

Later in the week, a program that uses your street light to draw a street scene will be posted. Look for it HERE.

In your overall sketch pay special attention to the aesthetic aspects of your design.


Extra Credit: (1) In addition to the standard street scene provided, model one of your own chosing. (2) Design the street light so it can be placed on either side of the street. (3) Draw a halo showing the illuminated area of the street when the light is turned on.

What to Hand in: Hand in the entire sketch folder in your Dropbox folder. In addition to the sketch/programs also include; (1) a gif/jpg/png image of your finished sketch. (2) A formatted write-up with Page#1 showing your sketch, followed by a title, your name, a short 1-2 line description (as discussed in class) on page#1, and a short 1-2 paragraph more detailed description of the sketch and your personal experiences working on this sketch.

Back to CMSC110 Course Web Page