CMSC110 (Introduction to Computing)
Spring 2014
Assignment#5 Object-Oriented Program
Due before start of class on Tuesday, April 15, 2013
First, read Chapter 6 from GXK.
Design an underwater creature. The creature should be designed so that it can be instantiated as an object. Make sure you name the class as <YourFirstInitialLastName>Thingy. For example Jia Tao's creature will be JTaoThingy. You should be able to create instances of the creature with varying sizes. In addition to the constructor, make sure that the class includes a method called display() so that one could incorporate your creature in a sketch as follows:
JTaoThingy JTFish; // An instance of JTaoThingy will be called JTFish float SIZE; // The SIZE of the instance that will be created void setup() { size(_, _); smooth(); SIZE = ...; JTFish = new JTaoThingy(SIZE); // Create an instance with size, SIZE ... } // end of setup void draw() { // display the creature JTFish.display(); } // end of draw class JTaoThingy { // Definition of the creature JTaoThingy JTaoThingy(float _size) { ... } void display(...) { ... } // display() ... }// end of class JTaoThingy
The focus should be on the use of classes to define the object factory. You will need to write the constructor, and the operations as described above.
Make sure that your creature is not too small, nor too large, as it will have to live in an aquarium with 40+ other creatures!
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