CMSC110 (Introduction to Computing)
Fall 2019
Assignment#6
Due before start of class on Thursday, December 5, 2019
NOTE: This is a FIRM deadline (no exceptions!)
Task: Design an underwater creature. Everyone's creature will then be included in a Class Aquarium (by Deepak) and displayed on teh hallway monitor. Below, we detail the features of the creatures you will need to design and implement.
Step 1: 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 Deepak Kumar's
creature will be defined in a class called DKumarThingy. Jingling Wang's
creature will be JWangThingy. 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:
DKumarThingy DKFish; // An instance of DKumarThingy will be called DKFish float SIZE; // The SIZE of the instance that will be created void setup() { size(_, _); // This could be as big as full screen SIZE = ...; DKFish = new DKumarThingy(SIZE); // Create an instance with size, SIZE ... } // setup() void draw() { background(255); // display the creature DKFish.display(); } // draw() class DKumarThingy { // Definition of the creature DKumarThingy
DKumarThingy(float _size) { // Constructor ... } // DKumarThingy() void display(...) { // Display the creature pushMatrix(); // These are need to preserve sanity of global coordinate system // Draw the creature according to its attributes
...
popMatrix(); } // display() // other methods/behaviors will go here (see below) ... }// end of class DKumarThingy
The focus should be on the use of classes to define the object factory. You will need to write the constructor, and the operation(s) as described above. Write and test this part first. Spend a considerable amount of time designing the creature. Your submission will be graded based on the quality of your design.
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!
Step 2: Next, you will extend the creature's
definition. Add a new behavior move() to your creature's class.
Depending upon the creature you designed in Step 1, 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. Be creative!
If the creature is moving
about, make sure that it either stays within the bounds of the
sketch or emerges at the other end. Strategies for implementing
these will be discussed in class. Examples from the past will be displayed on the BIG SCREEN in the hallway. Stop by and spend some time identifying the good designs and behaviors. Here is a revised skeletal
sketch that will create one instance of the creature and have it
show its behavior.
DKumarThingy DKFish; // An instance of DKumarThingy will be called DKFish float SIZE; // The SIZE of the instance that will be created void setup() { size(_, _); // This could be as big as full screen SIZE = ...; DKFish = new DKumarThingy(SIZE); // Create an instance with size, SIZE ... } // setup() void draw() { background(255); // the creature moves
DKFish.move();
// display the creature DKFish.display(); } // draw() class DKumarThingy { // Definition of the creature DKumarThingy
DKumarThingy(float _size) { // Constructor ... } // DKumarThingy() void display(...) { // Display the creature
void move() { // move the creature
...
} // move() ... } // class DKumarThingy
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, moving about. Make it full screen.
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 printout is necessary. Any sketch submitted AFTER the posted deadline (see above) will result in penalty on grade.
Grading will be based on the design and aesthetics of the creature (40%), its motion/behavior (30%), corretcness (20), and good program writing style(10%).
Extra Credit: You will earn 0.3 Extra Credit for submitting the assignment by Tuesday, December 3 at 11:55p.
Late Submissions: There will be NO LATE SUBMISSIONS accepted, under ANY circumstances. All submissions should be uploaded in dropbox by 11:55p on Thursday, December 5. NO CREDIT will be awarded for any submissions/modifications after the deadline. Start NOW, there is plenty of time.
Back to CMSC110 Course Web Page