Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include using namespace std; /* Create a Zoo. Randomly fill it with: 1-) Lion 2-) Bird 3-) Fish Include the following attributes for each

#include #include using namespace std; /* Create a Zoo. Randomly fill it with: 1-) Lion 2-) Bird 3-) Fish

Include the following attributes for each animal: Lion: Food type it lines Bird: Number of Eggs it lays every week Fish: How fast they swim

Then, display the Zoo statistics, counting how many of each animal we have.

Zoo size Max: 30 */

class Animal { public: virtual string gettype() = 0; };

class Lion : public Animal { public: string gettype() { return "Lion"; } };

class Fish : public Animal { public: string gettype() { return "Fish"; } };

class Bird: public Animal { public: string gettype() { return "Bird"; } };

void main() { Animal *Zoo[30];

Zoo[0] = new Lion(); Zoo[1] = new Bird(); Zoo[2] = new Fish();

for (int i = 0; i < 3; i++) cout << Zoo[i] << " " << Zoo[i]->gettype() << endl;

}

please c++

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

(1) f X(x). Pg45

Answered: 1 week ago

Question

sharing of non-material benefits such as time and affection;

Answered: 1 week ago