Object-oriented work

posted by: Ms. Martin 13 December 2009 One Comment

You should be ready to turn in three examples of object-oriented work by Wednesday.

1. Animal Class

Your animal must have at least three methods and three pieces of state.  You must have written client code that creates objects of your animal type and tests what they can do.  You will turn in both the class and your client.

2. Pyramid Seeker

See the creating turtle objects handout for requirements.

3. Turtle Inheritance

For this, you should demonstrate an understanding of creating classes that inherit behavior from Turtles.  You have three options, ordered by complexity and interestingness.

Option 1: some kind of critter on the screen

Create some sort of interactive class whose objects add interesting behavior or visuals to turtles.  See my frog example for the bare minimum.  Ideas include creating a button class that can be placed in different locations when created or creating a zoo of multiple animal types that can interact with each other.

Option 2: the coin collector

The coin collector is a type of turtle that roams around randomly “eating” coins and getting points for each one it gets.  Starter code found here sets up all the coins.  You may either create a new type of CoinCollectors that have state for coins collected and other specialized behavior or work with plain turtles.  Your creature should roam collecting coins and getting bigger with each one until it exits the coin grid.  Then, it should stop and print how many points it got (one per coin).

Option 3: etch-a-sketch

Create an etch a sketch program.  You should create a new type called something like EtchCursor that represents a hidden turtle controlled by keyboard arrow keys.  For extra awesomeness, clicking somewhere (either on a button you draw or just on the screen) should refresh the drawing.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>