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.

Pet.java technical details:

One Constructor the first three parameters are passed to the Animal class constructor in the first line of the Pet constructor by using the super reference.

Constructor. It will take all the parameters as listed:

int animalID.

String animalType. double weight.

String name;

String owner:

Instance variables for the Pet class

String name;

String owner:

Method which must be part of the Pet class:

A toString() method which displays information about an animal in the following format:

ID: 5089 Type: Fish Weight: 0.2

Name: Sally Owner: Henry Santos

Note: The toString() Method gets the first line of output from the Animal class toString method.

Animal is a parent class of the Pet class.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!