Lab 3: Inheritance at the Zoo!

Due Date and Submission Requirements


The goal of this lab is:


Background and Directions

You've been tasked with writing Java classes that keep track of animal information at the new Bozeman Zoo (coming soon... hopefully).

Using ZooDemo.Java, you will fill in the missing classes/methods to get the desired output seen below. You are NOT allowed to modify ZooDemo.java. There are three types of animals you need to keep track of
A Amphibian.java class. An Amphibian has the following information:

A Lion.java class. A lion has the following information: A Bird.java class. A bird has the following information:
All three of these classes must inherit from an Animal class, which holds information about a basic animal. You must determine which instance fields/methods go inside of the Animal class (if you get stuck here, look back on our Food example from class ). You must define the following methods: getSpecies(), getWeight(), getContinent(), getDiet(), getWingSpan(), and getPackSize(). You must figure out which class these methods go in (remember you are using inheritance)!!.

You must also define the checkPopulation() method. Before returning this.population, this method should check to see if that animal species is endangered or not. An animal species is considered endangered of the remaining population of that animal is less than or equal to 2500. If the population is less than or equal to 2500, then this method should print out "This animal is endangered!".

Lastly, each type of animal has a makeSound() method. While the method name is the exact same, the output of this function changes from class to class. For the amphibian, this method should print out "The [species-name] goes Blub Blub!". For the lion, if should print out "The [species-name] goes Roarrr!". For the bird, it should print out "The [species-name] goes chirp chirp chirp!".

You do not need to use interfaces for this assignment.

Rules

You are NOT allowed to modify ZooDemo.java. If you modify ZooDemo.java in any way (other than changing the package statement line), the you will lose significant points!

Starting Code

Required Output

When your program is run, your output should look exactly the same as seen in this screenshot.

Grading (10 points)



Deductions
  • -5 points if inheritance is not used