Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab # 1 4 : Inheritance, Overloading, & Redefining Create a class to track Farmer Pete s livestock. For each animal the class should be
Lab #: Inheritance, Overloading,
& Redefining
Create a class to track Farmer Petes livestock.
For each animal the class should be able to track the
Name & age
Valid ages are an integer between to
Create methods to retrieve all of the attributes listed above
Write a method to display the attributes in a table format DisplayTable
Using overloading, create methods that will modify just the age, just the name, or the age and
name
Derive classes from the livestock class: Sheep & Pig.
Sheep & Pig should inherit from Animal
The sheep class should be extended to handle a wool type and wool color
The pig class should be extended to account for a tail type
Redefine the display in both classes to include the extended attributes They should both call
the DisplayTable method in Animal class
Use enumerated types for the main menu, WoolType, and TailType
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started