class Animal { protected String name; private int weight; public Animal(String n, int w) { name = n; weight = w; } public void eat(String food) { System.out.println(name + " eats some " + food + "."); weight += 0.5; } } // class Animal class Fish extends Animal { private int maxDepth; public Fish(String n, int w, int d) { super(n, w); maxDepth = d; } public void swim() { System.out.println(name + " swims."); } } // class Fish class Bird extends Animal { private int maxAltitude; public Bird(String n, int w, int a) { super(n, w); maxAltitude = a; } public void fly() { System.out.println(name + " flies."); } public void eat(String food) { System.out.println(name + " flutters its wings."); super.eat(food); } } // class Bird class Zoo { public static void main(String[] args) { Bird tweety = new Bird("Tweety", 3, 1000); tweety.eat("corn"); tweety.fly(); Fish b = new Fish("Bubbles", 13, 100); b.eat("fish food"); b.swim(); Animal w = new Fish("Willy", 4000, 1000); w.eat("tourists"); // w.swim(); -- Doesn't work. See below. } } // class Zoo