Question
Define an abstract class Animal . The class contains the following fields: averageWeight, date captured, int collarID (assuming all captured animals have an id around
Define an abstract class Animal.
The class contains the following fields: averageWeight, date captured, int collarID (assuming all captured animals have an id around their collars
The class also contains 2 abstract methods:
the first method makeSound() that returns a string and takes no
parameters. The intended returned string simulates the sound of the
animal.
The second method getAllHabitat(). It returns a string[] array and takes no parameter. The intended returned array is to hold a list of places where this animal can be found. Provide at least 3 places.
1-Define 3 classes Lion, Shark, Allegator. Each inherits the Animal class.
2-Create 3 instances of each class: Lion, Shark, Aligator.
3-Create a single List to hold all 3 animal types. Populate the list with the 3 lions, 3 harks and 3 alligators created is step 3
4-Add a button (within Frame) to display all the animals in the list to a JTable. Should have: Animal type, id, weight, date captured.
5-The class contains the following fields: averageWeight, date captured, int collarID (assuming all captured animals have an id around their collars
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