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 noargs constructor that sets some default values.
The following static constants have already been defined:
An int constant SMALLPOPULATION that stores the number ;
An int constant MEDIUMPOPULATION that stores the number ;
An int constant BIGPOPULATION that stores the number ;
A char constant SMALLANIMAL that stores the character S;
A char constant MEDIUMANIMAL that stores the character M;
A char constant BIGANIMAL 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, DEFAULTPOPULATIONSIZE, DEFAULTANIMALSIZE, and DEFAULTANIMALDIET, respectively initialized to MEDIUMPOPULATION, SMALLANIMAL, and HERBIVORE.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
