A new requirement has been handed down to add the ability to fly to the ducks on the SimUDuck game. The "solution" was to add a fly() method to the duck super class. Now, through inheritance, all ducks fly.

An unexpected complication has arisen however. Someone added a new Rubber Duck subclass to the Duck superclass. Rubber ducks shouldn't fly!

download: source code

Mallard Duck
Display:
Swim: This duck is swimming.
Quack: Quack!
Fly: I'm flying!
Redhead Duck
Display:
Swim: This duck is swimming.
Quack: Quack!
Fly: I'm flying!
Rubber Duck
Display:
Swim: This duck is swimming.
Quack: Squeak!
Fly: I'm flying!