Question
Need to implement at least four classes. The first class, Animal, stores basic data about an animal. The second class Pet, stores additional data about
Need to implement at least four classes. The first class, Animal, stores basic data about an animal. The second class Pet, stores additional data about an animal which is a pet. The third class ZooAnimal, stores additional data about an animal which is kept in a zoo. The fourth class ProgThree has a main method which reads data about animals, pets and zoo animals and creates a report about animals, pets and zoo animals.
The program must be developed following the guidelines previously discussed. These guidelines include appropriate variable names, use of comments to describe the purpose of the program and the purpose of each method, and proper use of indentation of all program statements.
animalType must be a string of at least three characters.
weight must be a valid positive real number.
For Pet objects, name and owner each must be strings of at least three characters.
For Zoo Animal objects, cageNumber must be a positive integer and trainer must be a string of at least three characters. ZooAnimal.java technical details:
One Constructor the first three parameters are passed to the Animal class constructor in the first line of the ZooAnimal constructor by using the super reference.
Constructor #1. It will take all the parameters as listed: |
int animalID. String animalType. double weight. int cageNumber. String trainer. |
Instance variables for the ZooAnimal class
int cageNumber. String trainer. |
Method which must be part of the ZooAnimal class:
A toString() method which displays information about an animal in the following format:
ID: 8850 Type: Fish Weight: 0.2
Cage: 103 Trainer: Suzie Tran
Note: The toString() Method gets the first line of output from the Animal class toString method.
Animal is a parent class of the ZooAnimal class.
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