Question: TASK: WRITE A PROGRAM TO DEFINE AN ANIMAL CLASS THAT HAS BASIC ATTRIBUTES ( e . g . , age ) and methods ( e

TASK: WRITE A PROGRAM TO DEFINE AN ANIMAL CLASS THAT HAS BASIC ATTRIBUTES
(e.g., age) and methods (e.g., metabolism, reproduction). write a program t create an object
of the animal class and then invoke the methods of it to output correspondingly some strings
like "xxx method is being executed".
Q1. Re-define the age attribute with private modifier. And, provide public get() and set()
methods for it.
Q2. Define a new constructor for Animal class. And, create an object using it.
Q3. improve the Animal class by
A. Providing details of the metabolism() method;
B. Providing details of the reproduce() method.
Correspondingly, update the UML diagram in accordance with your design.
 TASK: WRITE A PROGRAM TO DEFINE AN ANIMAL CLASS THAT HAS

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!