Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books