Question: 1 . Add swan type to the simulator. ( 2 0 points ) When they make a sound, it is called that Swans are honking
Add swan type to the simulator. points
When they make a sound, it is called that Swans are honking
Swans can swim and fly.
a Add Swan class to infoDuckSimulator
b Add Swan class to infoDuckSimulator since it has another class hierarchy.
Add snake type to the simulator. points
Work on infoDuckSimulator 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.
Add diving behavior to the whole system. points
Work on infoDuckSimulator package.
Modify TinyDuckSimulatorjava 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
