Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Add a thirst feature to Animal, as well as an appropriately named getter & modifier. Make sure all 5 classes still compile & run just
Add a thirst feature to Animal, as well as an appropriately named getter & modifier. Make sure all classes still compile & run just fine. You'll need to change the Animal class, as well as the constructors for all animal classes. Make sure all animal types can report their thirst and drink. Place these new function calls under the existing Speak calls in main report drink, report.
Create a second main file that uses command line arguments to facilitate generating any number and variety of animals. It should accept two CLAs:
numberofanimals will control a loop that prompts the user for what type of animal they wish to be created you have possible types.
filename is the name of the file that contains a list of animals to be created and their default constructor values.
For the file given, it should behave as such:
g maincpp Animal.cpp o prog && prog animals.txt
Woof!
Woof!
Meow!
Sss
Squeak!
Woof!
Chirp!
Woof!
Notes:
Animal is how you can create the array to store the animals in step ie Animal arr new Animal; creates an array that stores animal pointers. Use the new keyword to instantiate each animal during runtime!
You can also use s
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