Description
This activity will have you create a new subclass of the Kangaroo class and add an object of that class using the Greenfoot IDE. In this activity, you will:
- Create a new class - RedKangaroo and cut and paste code to give it new behavior.
- Compile your new class. Create a new object of this class and add it to the wombatWorld
Skills you will learn include:
- Learn how to use subclassing to create new classes without writing or copying a lot of code.
- Learn about compiler error messages and how to deal with them.
- Learn some basic programming concepts and constructs.
- Learn how to use Sun’s online Java programming manuals.
Basic Steps
- Start up Greenfoot.
- Make sure you have opened the Wombats scenario. If not, click Scenario->Open… and select Wombats.
- Download and save the Red Kangaroo image.
- Right mouse click (you Mac folks may now laugh at "right mouse click", but you know what I mean!) on the Kangaroo class located on the right side of the IDE. Select New Subclass... . Name your new class RedKangaroo and for the image, click Browse for more images... and go find the Red Kangaroo that you saved.
- At this point, visit the Smarter Ways of Making New Classes - Digging Deeper page, and follow the tutorial. It will provide some code to copy and paste into the RedKangaroo class, and teach you some cool stuff about Java and Object Oriented Programming.
- Compile RedKangaroo. Compile all
- Add wombats, kangaroos, red kangaroos and leaves and run the scenario.
- Please read the following instructions for preparing your work prior to submission to this activity.
- Select Scenario -> Export. Choose Webpage (from Publish, Webpage, Application) and select a location to save the scenario as an applet (a jar file and a .html file).
- Submit the exported jar file for this activity.



