Answered step by step
Verified Expert Solution
Link Copied!

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 #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

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

Step: 3

blur-text-image

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

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions