CJCoding With Joseph
15free / daySign inCreate account

Parrot and Owl both extend Bird and override sound(). A parameter of type Bird accepts any of the three, and when a method is called on it Java runs the version that belongs to the real object. Complete introduce in the Aviary class.

Requirements: 1. introduce(Bird bird) returns the bird's name, the word says and the bird's sound, separated by single spaces. A parrot named Polly gives Polly says Hello. 2. Do not test which kind of bird it is. Call getName() and sound() on the parameter and let Java pick the right sound().

The Bird, Parrot and Owl classes are provided. Do not change them. The tests also pass a kind of bird that is not in this file.

Do NOT write a main method.

Expected output

Polly says Hello
Olive says Hoot
Robin says ...

= newline. The output ends with a newline, so print one after the last line.

Hints3 available
Topics
InheritanceClasses
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)

Your output

Run your code to see the output here...

Test cases

Run your code to see test case results.