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
eg age and methods eg 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".
OBJECTIVE:
a Create a Java classs and practice class usuage.
b Understand class members and their propertise.
c Understand the abstraction and encapsulation concepts of OOP.
Q Redefine the age attribute with private modifier. And, provide public get and set
methods for it
Q Define a new constructor for Animal class. And, create an object using it
Q 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.
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
