Question: JAVA LANGUAGE A day at a Zoo Step1: Define Animal Class with four properties: 1. Species -ex. Lion, cow or anything else. 2. Max Weight

JAVA LANGUAGE

JAVA LANGUAGE A day at a Zoo Step1: Define Animal Class with

four properties: 1. Species -ex. Lion, cow or anything else. 2. Max

A day at a Zoo Step1: Define Animal Class with four properties: 1. Species -ex. Lion, cow or anything else. 2. Max Weight - The maximum average weight of an adult of the species. 3. Habitat - ex. Jungle, ocean, or mountain, ... etc. 4. Is Endangered- Flag to indicate whether the animal species is endangered. Step2: Add a default constructor, with any default values that you feel be required. Step3: Add a parametrized constructor to allow setting of all properties on object creation. Step4: Determine scope/access of properties: - Are they completely internal to the class? - should an external class be permitted to read the property values? - should an external class be permitted to change the property values? Step 5: Create appropriate Getter/Setter methods, as required. Step 6: Create three methods, i.e., actions that Animal instances can do, or that involve Animal objects. - Animal can be fed-ex. Feed a Tiger a Steak. - Animal can make sound-ex. A Cow can "moo". - In our program, an animal can report its state. (Use toString()): *. Ex., "I am a 500lb tiger that lives in the jungle. I am an Endangered species." - Note: Let's do all console printing in Main(), not Animal. Step 7: Add the three Animals to the Zoo(Object Array). Step 8: Let's interact with our objects, to test their functionality. Create a loop to take each Animal out of the Zoo and call its methods

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 Databases Questions!