Question: java problem. Animal class Animal initializes the Animal with a name and age getAge returns the Animals age getName returns the Animals name move increments

 java problem. Animal class Animal initializes the Animal with a name

java problem.

Animal class

Animal initializes the Animal with a name and age

getAge returns the Animals age

getName returns the Animals name

move increments the Animals position by distance.

vocalize abstract

Bird class

Bird initializes the Bird with a name and age

vocalize returns chirp

fly displays the message, flap-flap

Dog class

Dog(name,age) initializes the Dog with a name and age

Dog(name,age,ferocity) initializes the Dog with a name, age, and ferocity

vocalize returns bark

AgeComparator class

Compare compares two Animals based on their age

Person class

pets an unordered collection of Animals that can be accessed by their name.

Person creates a Person

Person(list) creates a Person and initializes pets with the specified list of Animals.

addPet adds the Animal to the pets collection

getPet returns the Animal with the specified name

getPets returns a list of the pets ordered by the specified comparator

givePetAway the Animal with the specified name has his owner changed to the specified Person

makePetsVocalize a string is returned with the name of each pet and their corresponding vocalization

makePetsFly all pets that fly should be made to fly.

movePet the pet with the specified name is moved by the specified distance.

petDies the Animal with the specified name is removed from the pets collection

Write the code for the system shown in the class diagram below and notes which follow. Animal Person IFI -name:String -position:int #agent +Animal(name:Strin +Person0 +Person(list:List) +addPet(a:Animal) +getPet(name:String):Animal +getPets(c:Comparator): fly0 age:int) List +givePetAway(name:String, +getName0:String newOwner:Person) +makePetsVocalize0:String +makePetsFly0 +movePet(name:String, distance:int) +petDies(name:String):boolean +move(distance:int) +vocalize() String Bird -ferocity:int +Dog(name:String, +Bird(name:String, age:int) +vocalize0:String +fly0 ComparatorKT> compare(o1:T,o2:T):int ageint) +Dog(name:String, age:int, ferocity:int) AgeComparatorAnimal> +compare(a1:Animal, +vocalizeO:String a2:Animal) int

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!