Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started