CMSC110 (Introduction to Computing)

Fall 2010

Assignment#5

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

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

Task: Design an underwater creature. The ceature should be designed so that it can be instantiated as an object. Make sure you name the class as <YourFirstInitialLastName>Unit. For example Deepak's creature will be defined in a class called DKumarUnit. You should be able to create instances o fthe creature with varying sizes. In addition to the constructor, make sure that the class includes methods called display(), and move() so that one could incorporate your creature in a sketch as follows:

DKumarUnit DKFish;

float SIZE;

void setup() {
	size(_, _);
  smooth();
  SIZE = ...;
  DKFish = new DKFish(SIZE);
...

}
 // end of setup


void draw() {
	
  
  // display the creature
  DKFish.display();
  
  // move it
	DKFish.move();


} // end of draw


class DKFish {
 void DKFish(...) {
	...
 }


 void display(...) {

	...
 }

 
 void move() {
...
 }

   ...
}// end of class DKFish

The focus should be on the use of classes to define the object factory. You will need to write the constructor, and various operations as described above.

Make sure that your creature is not too small, nor too large, as it will have to live in an aqauarium with a couple of dozen other creatures!

Depending upon the creature you design, define appropriate move behavior. Some creatures will swim like a fish, or a submarine, some will wiggle about, some might just stay in one place and rotate, bubble, etc.

In your overall sketch pay special attention to the aesthetic aspects of your design. Write your own aquarium sketch where you can display several creatures of varying sizes. Make it 800x600 pixels.

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