Question: 1 . Add swan type to the simulator. ( 2 0 points ) When they make a sound, it is called that Swans are honking

1. Add swan type to the simulator. (20 points)
When they make a sound, it is called that Swans are honking.
Swans can swim and fly.
a. Add Swan class to info3150_DuckSimulator04
b. Add Swan class to info3150_DuckSimulator07, since it has another class hierarchy.
2. Add snake type to the simulator. (40 points)
Work on info3150_DuckSimulator07 package.
Create Snake class that includes methods: Hiss and Swim.
Although snakes are not a type of duck, integrate the Snake class with the Duck class using the Bridge Patternor Adapter Pattern.
In other words, Snake cannot be inherited from Duck, you need a bridge or adapter mechanism in between.
You may pick using any of these two patterns, which is easier to implement.
3. Add diving behavior to the whole system. (40 points)
Work on info3150_DuckSimulator07 package.
Modify TinyDuckSimulator07.java to list which types are diving in the water.
You need to define a class hierarchy for DiveBehavior, like the FlyBehavior, and use it for all Duck types.
Redhead ducks and snakes can dive into the water.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!