Zoo Exhibit with Abstract Animals and Feedable Interface
hardQuestion 205Build a small zoo exhibit system.
1. Create an interface Feedable with a method String food().
2. Create an abstract class ZooAnimal that implements Feedable. It has a protected String name and a constructor. It declares an abstract method String exhibit() but does NOT implement food() — subclasses must implement both.
3. Create Lion extending ZooAnimal. Constructor takes name. exhibit() returns "Savanna". food() returns "meat".
4. Create Penguin extending ZooAnimal. Constructor takes name. exhibit() returns "Arctic". food() returns "fish".
Do NOT write a main method.
Expected output
Simba lives in Savanna and eats meat Tux lives in Arctic and eats fish
= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
Abstract ClassesInterfacesInheritanceClasses
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.