Convert the UML class diagram above into a java code with the following conditions The methods in the Pet class are abstract. Create a class called test. The main() method in the test class should create three Cat objects and two Budgie The main() method should also create indirectly an object of the Pet class.  Demonstrate polymorphism in your test

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter10: Object-oriented Programming
Section: Chapter Questions
Problem 1GZ
icon
Related questions
Question

Convert the UML class diagram above into a java code with the following conditions

  1. The methods in the Pet class are abstract.
  2. Create a class called test. The main() method in the test class should create three Cat objects and two Budgie The main() method should also create indirectly an object of the Pet class. 
  3. Demonstrate polymorphism in your test
Pet
name : String
ownerName : String
+ Pet (name:String, ownerName: String)
+ getName () : String
+ getownerName ()
: String
Cat
Budgie
numberofTeeth : int
- lengthofTail : int
colourofFeathers : String
+ Cat (name :String, ownerName: String,
numberofTeeth:int,
lengthofTail:int)
+ Budgie (name: String,
OwnerName:String,
colourofFeathers:String)
+ getNumberofTeeth (): int
+ getLengthofTail () : int
getcolourofFeathers () : String
Transcribed Image Text:Pet name : String ownerName : String + Pet (name:String, ownerName: String) + getName () : String + getownerName () : String Cat Budgie numberofTeeth : int - lengthofTail : int colourofFeathers : String + Cat (name :String, ownerName: String, numberofTeeth:int, lengthofTail:int) + Budgie (name: String, OwnerName:String, colourofFeathers:String) + getNumberofTeeth (): int + getLengthofTail () : int getcolourofFeathers () : String
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Software Development
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT