This week's project is to extend your Java, Ada, and Ruby class hierarchies with some new classes:
As in the lab exercise, each kind of bird should respond appropriately to name() and call() messages. However, where owls, geese, and ducks are flying birds, penguins, ostriches, and kiwis are non-flying birds, so you are to modify things such that (for example) C++ code like this:
Bird * birdPtr0 = new Duck("Donald");
Bird * birdPtr1 = new Penguin("Peter);
Bird * birdPtr2 = new Goose("Mother");
Bird * birdPtr3 = new Ostrich("Orville");
...
birdPtr0->print();
birdPtr1->print();
birdPtr2->print();
birdPtr3->print();
...
will produce output like this:
Donald Duck just flew past and said, "Quack" Peter Penguin just walked past and said, "Huh-huh-huh-huuuuh" Mother Goose just flew past and said, "Honk" Orville Ostrich just walked past and said, "Snork" ...(You can make up your own call for a kiwi.)
To make all of this happen with a minimal amount of code, you are to rewrite the print() method in class Bird to be something like the following:
inline void Bird::print(ostream & out) const {
out <<name()
<<' '
<< className()
<< " just "
<< movement()
<< " and said "
<< call();
}
In order for this to work, you should
The resulting class hierarchy should look something like this:
Testing. In each language, modify the birds program so that it demonstrates that your class hierarchy works correctly. Make certain that it creates instances of all six 'leaf' classes in the hierarchy.
Turn in. Using an approach like what we did in the lab, make a single script file named proj10-results, in which you list all of the files for each program, show that it builds without any syntax errors or warnings, and show some executions that demonstrate its correctness. Then submit your project by copying that single file into your personal folder in /home/cs/214/current/:
cp proj10-results /home/cs/214/current/yourUserName
replacing yourUserName with your login name.
The grader will access and grade your project results from there,
using the criteria from
this grade sheet.
Calvin > CS > 214 > Projects > 10