Question: download Pet.java and PetDriver.java from the attached links. Complete the Pet hierarchy as follows: Pet / | Dog Cat SmallAnimal / Hamster Rabbit

download Pet.java and PetDriver.java from the attached links. Complete the Pet hierarchy as follows: Pet / | \ Dog Cat SmallAnimal / \ Hamster Rabbit All Pets can eat, sleep and play. Dogs can bark and dig. Cats can purr and scratch. Small Animals can chew. Hamsters can run on wheels. Rabbits can thump. After you complete all classes, run

PetDriver.java and ensure that your output matches the output attached. public class

PetDriver { public static void main(String[] args) { Cat oakey = new Cat("Oakey", 6, 18.5); Dog roxie = new Dog("Roxie", 12, 33.6); Hamster scooter = new Hamster("Scooter", 1, 0.3); Rabbit bigBunny = new Rabbit("Big Bunny", 9, 7.0); Pet thing = new Pet("Mystery Creature", 5, 10.0); System.out.println(oakey); System.out.println(roxie); System.out.println(scooter); System.out.println(bigBunny); System.out.println(thing); oakey.eat(); roxie.dig(); scooter.celebrateBirthday(); bigBunny.chew(); thing.play(); oakey.scratch(); roxie.eat(); scooter.runOnWheel(); bigBunny.thump(); thing.sleep(); } }

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!