CMSC110 (Introduction to Computing)
Fall 2013
Assignment#5
Due before start of class on Tuesday, November 12, 2013
Code file for Assignment#5: Click here.
First, read Chapters 1, 2, 3, 4. 5, 6, from your 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.
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. No printouts are necessary.
Back to CMSC110 Course Web Page