The xxx_Pet classA Pet has a:– Name• Include an instance variable• Getters and setters for an instance variable• A toString method which returns a String containing the pet name Abstract methods: speak() and move()The subclassesWrite a dog, cat, snake subclasses with proper instant variables and methodsWrite a class xxx_TestPet which will1- Create a dog, a snake, and a cat objectsSample OutputPet Fido is a dog, weighing 45 poundsFido says woofrun Fido runPet Sam is a snake, 30 inches longSam says hissslither Sam slitherPet Hershey is a cat, with Long hairHershey says Meowprance Hershey prance2- Print just the weight of the Dog, the length of the Snake and the hair length of theCat as shown belowFido weighs 45 poundsSam has length 30 inchesHershey has Long hair 3- Store the objects in an Array of Pet objects and print the information belowPet D1 is a dog, weighing 55 poundswoofrunPet S1 is a snake, 30 inches longhissslitherPet C1 is a cat, with Long hairmeowprancePet D2 is a dog, weighing 15 poundswoofrunPet C2 is a cat, with Short hairmeowprance

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

The xxx_Pet class
A Pet has a:
– Name
• Include an instance variable
• Getters and setters for an instance variable
• A toString method which returns a String containing the pet name
 Abstract methods: speak() and move()
The subclasses
Write a dog, cat, snake subclasses with proper instant variables and methods
Write a class xxx_TestPet which will
1- Create a dog, a snake, and a cat objects
Sample Output
Pet Fido is a dog, weighing 45 pounds
Fido says woof
run Fido run
Pet Sam is a snake, 30 inches long
Sam says hiss
slither Sam slither
Pet Hershey is a cat, with Long hair
Hershey says Meow
prance Hershey prance
2- Print just the weight of the Dog, the length of the Snake and the hair length of the
Cat as shown below
Fido weighs 45 pounds
Sam has length 30 inches
Hershey has Long hair

3- Store the objects in an Array of Pet objects and print the information below
Pet D1 is a dog, weighing 55 pounds
woof
run
Pet S1 is a snake, 30 inches long
hiss
slither
Pet C1 is a cat, with Long hair
meow
prance
Pet D2 is a dog, weighing 15 pounds
woof
run
Pet C2 is a cat, with Short hair
meow
prance

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Unreferenced Objects
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education