CIS 11: Data Structures & Algorithms
Project M (Optional)
Implement the Carnivore class described in Chapter
14, Exercise 14 on page 702.
- Files in the project:
- organism.h:
Header file for the Organism class and various derived classes. You'll
need to add the Carnivore class declaration at the bottom.
- organism.cpp:
This file should contain the implementations of the Organism class
and the various derived classes (Plant, Herbivore, and Carnivore).
You should start with downloaded version. You'll need to add the
Carnivore's constructor and the chase() member
function. This is the only file that you will submit.
- ecosystem.cpp:
A demonstration program that shows how the new Carnivore class might
be used in a program that simulates a small ecosystem. In order to compile and run the
ecosystem program you'll also need to download bag.h and bag.cpp.
- The objective of the project:
- You should exercise the simulation to gain a feeling for the dynamics of the interactions among the organisms.
- The constants
set at the top of the program are not very stable. They cause the
foxes to quickly die out and then the goose population explodes. You
will want to experiment with them.
- Write a paragraph or two describing your findings.
When you're satisfied with the implementation, submit your work via the
CATE form for Project
M.
2005/05/12