CSCI 235 Spring 2015
Data Structures and Software Design
Archived Class
Charles Cusack
Computer Science
Hope College



CSCI 112
CSCI 125


Homework 5


The next two assignments will be related to the Foxes And Rabbits simulation. In this assignment you will add a third creature. In the next assignment you will improve the GUI. You can see an example of what a finished Homework 5 might look like by downloading and running FoxesAndRabbitsAndSasquatch.jar. (There is only 1 Sasquatch and he eats everything around him. As you can see by running this, he doesn't really affect the simulation much.)

For this assignment you will improve the Foxes And Rabbits simulation by adding another creature.

The third creature must not be another animal (i.e. it cannot be a subclass of Animal), and you should try to think of a creature that will affect the simulation in some significant way. You should perform some of the suggestions from the textbook to create an Actor class, refactor the code accordingly, and add your third creature. Some ideas for creatures include a human, a virus, a dragon, weather, fire, etc. It must act different than both the fox and the rabbit in some significant way (e.g. never dies, doesn't breed, kills everything within 1 or 2 squares (but as Sasquatch demonstrates, having one such creature is boring), kills everything in its row and column, teleports, etc.).

If you did a similar assignment to this in CSCI 225, you should implement a different sort of creature for this assignment and you should not use any of that code. You will learn more this way, and isn't that the point?

You should start with the code available at And Rabbits 3. Follow the instructions from the appropriate section of SVN and Eclipse Examples to get the code. Note: This code is based on an earlier addition of the textbook and has been modified to make the next assignment easier.


  • Use what you have learned about inheritance and polymorphism to implement this properly.
  • Do not just sit down and start programming—it will be much easier to implement if you first sit down and think about design.

For more of a challenge (and bonus points), do any of the following:

  • Make the drawing of the simulation a bit fancier. You can draw actual foxes and rabbits, or use little circles for bunnies and triangles for foxes or something similar.
  • Add a fourth creature that is significantly different than the others.

Your grade will be based on:


Hand it in as follows
  1. Fill in the details of the MyGrade-HW5.txt file in your project (double-click it to edit it) with your self-evaluation. Make sure you provide the total (out of 30) and a justification for each category. Your justification should be more than one or two sentences but less than half a page. Also include a very brief description of the creature you added.
  2. In Windows Explorer, right click on the Foxes and Rabbits 3 folder and select Send to-->Compressed (zipped) folder.
  3. Name the zipfile whatever you wish.
  4. Use Webhandin with assignment 235-HW5 to submit the zipfile you just created.