Answered step by step
Verified Expert Solution
Link Copied!

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
(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".
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.
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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

IBM Db2 11 1 Certification Guide Explore Techniques To Master Database Programming And Administration Tasks In IBM Db2

Authors: Mohankumar Saraswatipura ,Robert Collins

1st Edition

1788626915, 978-1788626910

More Books

Students also viewed these Databases questions