CJCoding With Joseph
15free / daySign inCreate account

Zoo Exhibit with Abstract Animals and Feedable Interface

Build 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 — print one after the last line.

Hints4 available
Topics:
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.