Question: A zoo is developing a new caretaking system. You are tasked with implementing the code tracking a habitat's state. You are already given a basic

A zoo is developing a new caretaking system. You are tasked with implementing the code tracking a habitat's state. You are already given a basic implementation of the class Habitat.
The class Habitat has the following instance member fields:
An int field maxPopulation;
A char field animalSize;
A char field animalDiet;
As most of the Zoo's animals have similar needs, the class is instantiated through a no-args constructor that sets some default values.
The following static constants have already been defined:
An int constant SMALL_POPULATION that stores the number 6;
An int constant MEDIUM_POPULATION that stores the number 12;
An int constant BIG_POPULATION that stores the number 18;
A char constant SMALL_ANIMAL that stores the character S;
A char constant MEDIUM_ANIMAL that stores the character M;
A char constant BIG_ANIMAL that stores the character B;
A char constant HERBIVORE that stores the character h;
A char constant OMNIVORE that stores the character o;
A char constant CARNIVORE that stores the character c;
Now, define three more public constants, DEFAULT_POPULATION_SIZE, DEFAULT_ANIMAL_SIZE, and DEFAULT_ANIMAL_DIET, respectively initialized to MEDIUM_POPULATION, SMALL_ANIMAL, and HERBIVORE.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!