Question: Code Explanation: A header file Zoo.h will be provided to you. All the variables are explained in the file. Zoo.cpp contains all the definition of

Code Explanation:

A header file Zoo.h will be provided to you. All the variables are explained in the file. Zoo.cpp contains all the definition of the functions. Details of the functions are provided in that fille. Please read it carefully. Please note that there are two additional header files added. You can use them or add new according to your needs.

Use C++

Code Explanation: A header file Zoo.h will be provided to you. All

the variables are explained in the file. Zoo.cpp contains all the definition

Please Do BONUS Task

I am adding task 01 just because for your help to do solve the problem easier.

Now I am adding zoo.h and zoo.cpp file Accordingly....

Zoo.h

#ifndef ZOO_H_INCLUDED #define ZOO_H_INCLUDED #include

/* Variables Explanation ===============================================+========== --totalNoOfAnimal Total number of Animals --NoOfUniqueAnimal Number of Unique animals --xcordinate Co-ordinate of the Zoo along x-axis --ycordinate Co-ordinate of the Zoo along y-axis

--animals [1000] Stores name of Unique animals --noOfAnimalsEach[1000] Stores number of animals exists */

class Zoo { private: int totalNoOfAnimal, NoOfUniqueAnimal, xcordinate, ycordinate; std::string animals [1000]; int noOfAnimalsEach [1000]; public: Zoo(int, int, int); ~Zoo(); void setValue(std::string, int, int); int getNoanimalExist(int); int getAnimalIndex(std::string); };

#endif // ZOO_H_INCLUDED

------------------------------------------------------------------

Zoo.cpp

#include "Zoo.h" #include #include #include

using namespace std;

Zoo::Zoo (int u, int a, int b) //Constructor { xcordinate = a; ycordinate = b; totalNoOfAnimal=0; NoOfUniqueAnimal = u; animals [u]; noOfAnimalsEach[u]; }

Zoo::~Zoo() //Destructor { totalNoOfAnimal = NULL; NoOfUniqueAnimal = NULL; }

void Zoo:: setValue(string s, int x, int index) //This function populates the zoo. { animals [index]= s; noOfAnimalsEach[index]= x; totalNoOfAnimal+=x; }

int Zoo::getAnimalIndex(string name)//This function returns the index for each animal in the array. '-1' indicates when animals are not found. { int i=0; while (i

int Zoo:: getNoanimalExist(int index)//This function returns the number of animals exists for each unique animal in the 'animals' array by index. { if(index>=0) return noOfAnimalsEach[index]; else cout

-------------------------------------------------------------------------------------------------------------------------------------------

Please add output screenshort, Thank You

Task 01 Imagine there are 3 Zoos at the locations (co-ordinates): (13,17), (28,2), (7,14) with the following population- Tiger zoo_01 Animal List Quantity Tiger 4 Lion 3 Elephant 5 Zebra 2 Deer 7 Crocodile 10 Snake 20 zoo_02 Animal List Quantity Tiger 1 Lion 3 Deer 3 Zebra 4 Crocodile 5 Monkey 25 zoo_03 Animal List Quantity 4 Lion 2 Deer 5 Zebra 1 Crocodile 3 Turtles 25 Elephant 2 Birds 15 1 Now create the 3 Zoos accordingly. Make sure to give them unique names. BONUS In Zoo.h I have used 2 static array that I am using as my database. Write some codes to replace the whole database so that it becomes dynamic. You can do it in one of two ways- 1.Using two Dynamic arrays 2 or, 2.Using one 2D Dynamic array . Make sure you make appropriate changes to the Zoo.cpp file so the system is intact

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!