Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Interface Exercise Given the following UML Class diagram, answer the questions listed below. Notice that DomesticAnimal is an interface, Pet is an abstract class and

image text in transcribed

Interface Exercise Given the following UML Class diagram, answer the questions listed below. Notice that DomesticAnimal is an interface, Pet is an abstract class and adoption Completed is an abstract method. Owner -name:String +Owner (name:String) +getName():String 1 1 Q1. Create the above class hierarchy in Java. Having done so, create a test harness/application/run class named ShelterRun. Pet Q2. Create an owner named "Jack Black" #age:int #breed:String #owner Owner +Pet (breed:String, age:int) +getAge():int +getBreed():String +birthday () //increase +age by one +adoption Completed() // print +dog.name is adopted by the +owner.name +setOwner(o:Owner) +getOwner Name ():String Q3. Inside Shelter run, create a dog named "Max", that is a Golden Retriever and 5 years old. Set Max's owner as "Jack Black" and invoke the adoptionCompleted() method. Q4. Max loves to eat "dog biscuits" and sleeps 7 hours per day. Q5. As today is the birthday of Max, invoke the birthday method. Having done so, make sure Max runs from home to the park. Q6. Display max features as follows in a JOptionPane.showMessageDialog: Dog name = Max Dog breed = Golden Retriever Dog age = 6 Owner = Jack Black OK > DomesticAnimal Dog -name:String +Dog(b:String, a:int) +getName():String +setName(n:String) +isDomesticated:boolean = true +move(from:String, to:String):void // print "runs from to +to +eat(food:String):void // print eats #food +sleep(hours:int):void // sleeps thours hours per day

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

Create a refreshed and common vision and values across Europe.

Answered: 1 week ago

Question

Explain the various inventory management techniques in detail.

Answered: 1 week ago

Question

What is paper chromatography?

Answered: 1 week ago