Question: Lab # 1 4 : Inheritance, Overloading, & Redefining Create a class to track Farmer Pete s livestock. For each animal the class should be

Lab #14: 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 0 to 10
- 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!