Question: Solve in C++ Please!! Copy and paste the Zoo class below into the text editor. //add class definitions below this line class Zoo { public:
Solve in C++ Please!!
Copy and paste the Zoo class below into the text editor.
//add class definitions below this line class Zoo { public: Zoo(int bc, int p, int r, int b) { big_cats = bc; primates = p; reptiles = r; birds = b; } private: int big_cats; //for "big cats" int primates; //for "primates" int reptiles; //for "reptiles" int birds; //for "birds" }; //add class definitions above this line Your task is to add the following class functions to the class:
TotalAnimals - returns the total number of animals
TotalMammals - returns the number of mammals (which includes big_cats and primates)
MostAnimals - returns the name of the animal with the most count assuming no two animals have the same count
DO NOT CHANGE the existing code in main or you will not pass the test:
Zoo my_zoo(10, 30, 90, 120); cout << my_zoo.TotalAnimals() << endl; cout << my_zoo.TotalMammals() << endl; cout << my_zoo.MostAnimals() << endl; Zoo my_zoo2(123, 45, 67, 89); cout << my_zoo2.TotalAnimals() << endl; cout << my_zoo2.TotalMammals() << endl; cout << my_zoo2.MostAnimals() << endl;
Expected Result:
250 40 birds 324 168 big cats
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
