Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer Only Question Number 1 //zoo.cpp #include Zoo.h #include #include #include using namespace std; Zoo::Zoo (int u, int a, int b) //Constructor { xcordinate =

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed Answer Only Question Number 1

//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=0) return noOfAnimalsEach[index]; else cout 

//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
1 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 file. 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. 2 Tasks Task 01 Imagine there are 3 Zoos at the locations (co-ordinates): (13,17), (28,2), (7,14) with the following population- 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 5 zoo_03 Animal List Quantity Tiger 4 Lion 2 Deer 5 Zebra 1 Crocodile 3 Turtles 25 Elephant 2 Birds 15 1 1 Now create the 3 Zoos accordingly. Make sure to give them unique names. Task 02 Write some codes to print the following: 1. Which zoo has Elephants? 2. How many Snakes does ZOO_01 has? 3. Which zoo should I go to if I want to see Turtles? 4. Which zoo has the highest number of Deer? 5. Which zoo has the least number of Tiger and Lion combined? Task 03 Modify the Zoo.cpp file in the following manner: 1. Add a function that will return the total number of animals in a zoo. 2. Add a distance function that takes the user's co-ordinate as inputs and returns the distance between the zoo and the user." 3. Add a print function that will print the list of animals the zoo has with their respective quantity. Task 04 Modify the Zoo.cpp file in the following manner: 1. Print which of the 3 zoos has the most number of animals. 2. If my co-ordinate is (-7,7), which zoo is the closest to me? 3. Assume 200_1 and ZOO_2 are going to marge. Now create a new zoo combining the two zoos together. 4. Write some codes so that a user can look up the quantity of any animal from the new zoo that you just created. 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. 3 Submission Guideline 1. All the task should be done in the main.cpp file. Differentiate between each task by using appropriate comments. 2. After performing each task take a whole window screenshot of the output and name it according to the task number (e.g. Tasko2 for task 2). There should be 3 screenshots for Task 2, 3 and 4. Refer to Figure 1b. Idistance = (x1 - x2)2 + (y1 - y2)? 2 You will score 10pts 3 You will score 25pts 2 3. Make a README.txt containing your Name, ID and a list of tasks you didn't do. Refer to Figure 1a. 4. Zip all the files rename the Zip file with your ID and upload the file in your respective google classroom 5. FAILURE to meet these requirements will incur a 10% penalty. However, if I am unable to identify you I will not check the copy all together. So please double check if you have submitted everything. Act 2xler Set 49 ASSIGNMENTO Save Open README.txt -/Desktop 1 Name. Ramiza Maliha 2 ID - 1430592642 3 Task Done Task01 - 1,2,3,5 Task62 - all Task83 - None TRSKM Tiger 4 Lion 3 Elephants Zobra? Crocodile 10 Snake 20 Deer NOWN TASK2 ) Which 200 h Elephant ANS: 200_01: 200 02 How many sorkes does 200_01 has! ANS: 20 Which 200 should I go to ir i want to see turtles ANS: 200.93 which 200 ha the highest number of Deer? ANS: 200.91 Which zooh the least number of Tiger and to combined? ANS: 200.91 TRSKOG Plain Text Tab Width 4 Ln 7. Col 13 INS FE (a) README.txt (b) Output.png Figure 1: Additional files 1 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 file. 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. 2 Tasks Task 01 Imagine there are 3 Zoos at the locations (co-ordinates): (13,17), (28,2), (7,14) with the following population- 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 5 zoo_03 Animal List Quantity Tiger 4 Lion 2 Deer 5 Zebra 1 Crocodile 3 Turtles 25 Elephant 2 Birds 15 1 1 Now create the 3 Zoos accordingly. Make sure to give them unique names. Task 02 Write some codes to print the following: 1. Which zoo has Elephants? 2. How many Snakes does ZOO_01 has? 3. Which zoo should I go to if I want to see Turtles? 4. Which zoo has the highest number of Deer? 5. Which zoo has the least number of Tiger and Lion combined? Task 03 Modify the Zoo.cpp file in the following manner: 1. Add a function that will return the total number of animals in a zoo. 2. Add a distance function that takes the user's co-ordinate as inputs and returns the distance between the zoo and the user." 3. Add a print function that will print the list of animals the zoo has with their respective quantity. Task 04 Modify the Zoo.cpp file in the following manner: 1. Print which of the 3 zoos has the most number of animals. 2. If my co-ordinate is (-7,7), which zoo is the closest to me? 3. Assume 200_1 and ZOO_2 are going to marge. Now create a new zoo combining the two zoos together. 4. Write some codes so that a user can look up the quantity of any animal from the new zoo that you just created. 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. 3 Submission Guideline 1. All the task should be done in the main.cpp file. Differentiate between each task by using appropriate comments. 2. After performing each task take a whole window screenshot of the output and name it according to the task number (e.g. Tasko2 for task 2). There should be 3 screenshots for Task 2, 3 and 4. Refer to Figure 1b. Idistance = (x1 - x2)2 + (y1 - y2)? 2 You will score 10pts 3 You will score 25pts 2 3. Make a README.txt containing your Name, ID and a list of tasks you didn't do. Refer to Figure 1a. 4. Zip all the files rename the Zip file with your ID and upload the file in your respective google classroom 5. FAILURE to meet these requirements will incur a 10% penalty. However, if I am unable to identify you I will not check the copy all together. So please double check if you have submitted everything. Act 2xler Set 49 ASSIGNMENTO Save Open README.txt -/Desktop 1 Name. Ramiza Maliha 2 ID - 1430592642 3 Task Done Task01 - 1,2,3,5 Task62 - all Task83 - None TRSKM Tiger 4 Lion 3 Elephants Zobra? Crocodile 10 Snake 20 Deer NOWN TASK2 ) Which 200 h Elephant ANS: 200_01: 200 02 How many sorkes does 200_01 has! ANS: 20 Which 200 should I go to ir i want to see turtles ANS: 200.93 which 200 ha the highest number of Deer? ANS: 200.91 Which zooh the least number of Tiger and to combined? ANS: 200.91 TRSKOG Plain Text Tab Width 4 Ln 7. Col 13 INS FE (a) README.txt (b) Output.png Figure 1: Additional files

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

Mastering Apache Cassandra 3 X An Expert Guide To Improving Database Scalability And Availability Without Compromising Performance

Authors: Aaron Ploetz ,Tejaswi Malepati ,Nishant Neeraj

3rd Edition

1789131499, 978-1789131499

More Books

Students also viewed these Databases questions

Question

1. Explain why talent management is important.

Answered: 1 week ago