Question: Revisited Cpp. #include #include #include #include using namespace std; /** This structure is to store the date and it has three integer fields **/ struct

 Revisited Cpp. #include #include #include #include using namespace std; /** Thisstructure is to store the date and it has three integer fields**/ struct Date{ int day; int month; int year; }; /** This

Revisited Cpp.

#include  #include  #include  #include  using namespace std; /** This structure is to store the date and it has three integer fields **/ struct Date{ int day; int month; int year; }; /** This structure is to store the size of the enclosure and it has three int fields **/ struct SizeOfEnclosure{ int length; int width; int height; }; /** This structure is to store the danger assessment. It contains a Char: 'V' or 'N' for venomous or non venomous. It also contains an int from 0-10 for the aggressiveness rating. **/ struct DangerAssessment{ char venoumous; int agression; }; /** This is the main mammal structure **/ struct Mammal { string species; Date birthDate; int weight; SizeOfEnclosure sizeofenclosure; string exhibitName; }; /** This is the main bird structure **/ struct Bird { string species; Date birthDate; int weight; char canFly; string exhibitName; }; /** This is the main reptile structure **/ struct Reptile { string species; DangerAssessment dangerAssess; Date birthDate; SizeOfEnclosure sizeofenclosure; string exhibitName; }; /** This is the main personnel structure **/ struct Personnel { string name; Date hireDate; string jobTitle; string exhibitName; }; /** The following are the functions that are used for opening the data files and reading contents into the respective struct arrays. Each function takes the input stream as the parameter. These four functions are mandatory as instructed in the Assignment **/ void getMammalsData(ifstream& inFile); void getReptilesData(ifstream& inFile); void getBirdsData(ifstream& inFile); void getPersonnelData(ifstream& inFile); /** Optional Helper Functions **/ void displayMammals(Mammal mammals[], int totalMammals); void displayReptiles(Reptile reptiles[], int totalReptiles); void displayBirds(Bird birds[], int totalBirds); void displayPersonnel(Personnel personnel[], int totalPersonnel); void printHorizontalLine( int width, char border_char); void printHeading( string title, int width ); int main() { cout > chosenOption; /** Do the correct action according to the chosenOption **/ string exhibitNameToFind; switch(chosenOption) { case 1: /** Mammals Function call to read data from input file. That function then calls a print Function **/ getMammalsData(inFileMammal); inFileMammal.close(); inFileMammal.open("Mammals.txt"); break; case 2: /** Birds Function call to read data from input file. That function then calls a print Function **/ getBirdsData(inFileBird); inFileBird.close(); inFileBird.open("Birds.txt"); break; case 3: /** Reptiles Function call to read data from input file. That function then calls a print Function **/ getReptilesData(inFileReptile); inFileReptile.close(); inFileReptile.open("Reptiles.txt"); break; case 4: /** Personnel Function call to read data from input file. That function then calls a print Function **/ getPersonnelData(inFilePersonnel); inFilePersonnel.close(); inFilePersonnel.open("Personnel.txt"); break; default: break; } }while(chosenOption != 5); return 0; } void printHorizontalLine( int width, char border_char){ cout.fill( border_char ); cout > totalMammals; Mammal mammals[totalMammals]; char decimal; for(int i = 0; i > mammals[i].species; inFile >> mammals[i].birthDate.month >> decimal >> mammals[i].birthDate.day >> decimal >> mammals[i].birthDate.year; inFile >> mammals[i].weight; inFile >> mammals[i].sizeofenclosure.length >> decimal >> mammals[i].sizeofenclosure.width >> decimal >> mammals[i].sizeofenclosure.height; inFile >> mammals[i].exhibitName; } inFile.close(); printHeading("Mammals", 60); displayMammals(mammals,totalMammals); } /** Using the input stream sent as parameter we are reading the content from the Reptiles.txt and storing it in the reptiles struct array **/ void getReptilesData(ifstream& inFile){ int totalReptiles; inFile >> totalReptiles; Reptile reptiles[totalReptiles]; char decimal; for(int i = 0; i > reptiles[i].species; inFile >> reptiles[i].dangerAssess.venoumous >> decimal >> reptiles[i].dangerAssess.agression; inFile >> reptiles[i].birthDate.month >> decimal >> reptiles[i].birthDate.day >> decimal >> reptiles[i].birthDate.year; inFile >> reptiles[i].sizeofenclosure.length >> decimal >> reptiles[i].sizeofenclosure.width >> decimal >> reptiles[i].sizeofenclosure.height; inFile >> reptiles[i].exhibitName; } inFile.close(); printHeading("Reptiles", 60); displayReptiles(reptiles,totalReptiles); } /** Using the input stream sent as parameter we are reading the content from the Birds.txt and storing it in the birds struct array **/ void getBirdsData(ifstream& inFile){ int totalBirds; inFile >> totalBirds; Bird birds[totalBirds]; char decimal; for(int i = 0; i > birds[i].species; inFile >> birds[i].birthDate.month >> decimal >> birds[i].birthDate.day >> decimal >> birds[i].birthDate.year; inFile >> birds[i].weight; inFile >> birds[i].canFly; inFile >> birds[i].exhibitName; } inFile.close(); printHeading("Birds", 60); displayBirds(birds,totalBirds); } /** Using the input stream sent as parameter we are reading the content from the Personnel.txt and storing it in the personnel struct array **/ void getPersonnelData(ifstream& inFile){ int totalPersonnel; inFile >> totalPersonnel; Personnel personnel[totalPersonnel]; char decimal; for(int i = 0; i > personnel[i].name; inFile >> personnel[i].hireDate.month >> decimal >> personnel[i].hireDate.day >> decimal >> personnel[i].hireDate.year; inFile >> personnel[i].jobTitle; inFile >> personnel[i].exhibitName; } inFile.close(); printHeading("Personnel", 60); displayPersonnel(personnel,totalPersonnel); } /** Displaying the content from the mammals struct array on the monitor **/ void displayMammals(Mammal mammals[], int totalMammals){ cout  

structure is to store the size of the enclosure and it has

three int fields **/ struct SizeOfEnclosure{ int length; int width; int height;

Objectives: The main objective of this assignment is checking students' ability to implement membership functions. After completing this assignment, students will be able to: implement member functions convert a standalone function to a member function convert a member function into a standalone function call member functions implement constructors use structs for function overloading Part-A (85 marks): Problem description: In this assignment, we will revisit Assignment #1 "the Zookeeper- implementing Structs". You will need to modify the program to allow its' functionality to be part of the struct as member functions. Your first task is to make the Mammals, Reptiles, Birds, and Personnel structs in header file(s). No structs should be defined in the main.cpp. You are then to create default constructors for the previous structs and any sub-structs. Create a member function for Mammals, Reptiles, Birds, and Personnel to put data into the struct Mammals, Reptiles, Birds, and Personnel should have a member function(s) to print out its' data. Mammals and Personnel should have a member function(s) to enable searching by exhibit name. Part-B (15 marks): Start a new Code::Blocks project for Part-B. Your task for this portion of the assignment is to make the member function you used for the search functionality into a non-member function. You will need to make the appropriate changes accordingly. Your program should also compile and run. The user of the program should not notice any difference when running the program with any of your implementations for Part-1 and Part-B of this assignment. This is Assignment 4 (Member Functions) - Part A Mannal Species I Date of Birth I Weight I Enclosure Size | Exhibit Nane 2: Rhino Lion Tapir Otter Fox Sheep Vole Cheetah Hedgehog Serval Shrew Bat Rabbit Seal Dolphin I 01:16:2000 I 05:14:2006 | 10:21:2015 I 09:08:2011 : I 06:03:2013: I 11:10:2004 I | 12:06:2014 : I 06:12:2003 ! I 07:18:2006 I I 08:22:2007 ! I 08:23:2015 : I 06:25:2016 1 I 04:23:2015 I I 08:26:2014 ! I 09:01:2017 : 5100 420 550 7 6 200 1 80 1 26 1 2 3 200 330 I 100:260: 50 I 150: 64: 55 90: 50: 30 50: 30: 20 30: 25: 34 50: 50: 20 1: 2 30: 30: 20 2: 3 10: 20: 4 1 2: 2: 3 I 6: 7: 15 3: 3: 2 I 50: 50: 20 I 200:200: 60 I Africa I Africa I Asia I Americas I Americas Europe I Europe Africa Europe Africa I Europe 1 Europe Europe I Antartica I Antartica 2: Bird Species I Date of Birth I Weight I Flying | Exhibit Name I I 1 I I I Y Y Y Eagle Falcon Parrot Emu Swan Mallard Pheasant Thrush Kiwi Treeswift Penguin Bluejay Petrel Goldfinch Gull Ostrich 04:01:2010 03:10:2013 06:21:2000 06:01:2005 07:06:2006 02:26:2008 02:27:2015 07:13:2012 08:17:2015 06:06:2016 03:22:2015 06:13:2013 04:14:2017 07:23:2016 03:20:2010 02:28:2014 I I I ! I I I I I I 10 03 03 80 25 03 92 01 07 01 51 01 02 01 93 50 Americas Americas Australia I Australia Europe I Europe Europe Asia I Australia Asia I Antartica I Americas I Antartica I Americas Antartica Africa I I I I I N Y Y Y Y I I Reptile Species ! Danger Assessment : Date of Birth : Enclosure Size : Exhibit Name I I I I I I I I I Chameleon Monitor Gecko Manba Viper Python Tortoise Crocodile Grass Snake 1 Blanus Anaconda Bothrops Turtle Teiidae Skink I N: 0 Y: 4 N: 1 Y:19 Y: 8 N: 7 N: 1 N: 7 N: 2 N: 1 N: 6 Y: 7 N: 1 N: 2 N: 1 I I 07:02:2015 06:15:2014 06:25:2017 08:29:2015 05:01:2010 04:19:2011 09:05:2002 05:20:2010 03:11:2016 06:24:2013 03:29:2016 06:15:2013 08:21:2012 10:22:2013 09:22:2013 01:02:01 Asia 10:05:05 I Asia 01:02:03 I Australia 03:03:04 I Africa 04:03:02 I Australia 03:03:02 L Africa 06:05:03 I Africa 30:30:03 I Africa 02:02:01 I Europe 03:02:01 Europe 10:10:05 Americas 03:03:04 1 Americas 03:02:01 L Americas 03:03:02 Americas 03:02:04 I Australia I I i I I ! I I I Personnel Name : Date of Hire I Job Title ! Exhibit Name I I 1 I 1 Malee Trevor Mohammad Aaron Ana Travis Justin Vincent Billur Jen Logan Ben Miranda Quinton Ron Laura Ashley I 11:09:2005 05:16:2010 09:01:2015 09:05:2002 10:21:2016 11:09:2005 11:10:2004 05:16:2010 11:09:2005 05:16:2010 12:11:2016 06:04:2002 02:06:2000 10:21:2014 06:04:2002 03:05:1999 06:04:2002 Veterinarian Cleaner Keeper Veterinarian Keeper Veterinarian Veterinarian Cleaner Keeper Cleaner Veterinarian Keeper Veterinarian Cleaner Keeper Cleaner Keeper I Africa I Americas Africa Asia | Australia Africa I Africa 1 Americas Africa Americas Europe Antartica America 1 Europe Europe I Antartica I Antartica I 1 I Would you like to search for mannals and personnel in a specific exhibit? (y'! Y' for yes) Objectives: The main objective of this assignment is checking students' ability to implement membership functions. After completing this assignment, students will be able to: implement member functions convert a standalone function to a member function convert a member function into a standalone function call member functions implement constructors use structs for function overloading Part-A (85 marks): Problem description: In this assignment, we will revisit Assignment #1 "the Zookeeper- implementing Structs". You will need to modify the program to allow its' functionality to be part of the struct as member functions. Your first task is to make the Mammals, Reptiles, Birds, and Personnel structs in header file(s). No structs should be defined in the main.cpp. You are then to create default constructors for the previous structs and any sub-structs. Create a member function for Mammals, Reptiles, Birds, and Personnel to put data into the struct Mammals, Reptiles, Birds, and Personnel should have a member function(s) to print out its' data. Mammals and Personnel should have a member function(s) to enable searching by exhibit name. Part-B (15 marks): Start a new Code::Blocks project for Part-B. Your task for this portion of the assignment is to make the member function you used for the search functionality into a non-member function. You will need to make the appropriate changes accordingly. Your program should also compile and run. The user of the program should not notice any difference when running the program with any of your implementations for Part-1 and Part-B of this assignment. This is Assignment 4 (Member Functions) - Part A Mannal Species I Date of Birth I Weight I Enclosure Size | Exhibit Nane 2: Rhino Lion Tapir Otter Fox Sheep Vole Cheetah Hedgehog Serval Shrew Bat Rabbit Seal Dolphin I 01:16:2000 I 05:14:2006 | 10:21:2015 I 09:08:2011 : I 06:03:2013: I 11:10:2004 I | 12:06:2014 : I 06:12:2003 ! I 07:18:2006 I I 08:22:2007 ! I 08:23:2015 : I 06:25:2016 1 I 04:23:2015 I I 08:26:2014 ! I 09:01:2017 : 5100 420 550 7 6 200 1 80 1 26 1 2 3 200 330 I 100:260: 50 I 150: 64: 55 90: 50: 30 50: 30: 20 30: 25: 34 50: 50: 20 1: 2 30: 30: 20 2: 3 10: 20: 4 1 2: 2: 3 I 6: 7: 15 3: 3: 2 I 50: 50: 20 I 200:200: 60 I Africa I Africa I Asia I Americas I Americas Europe I Europe Africa Europe Africa I Europe 1 Europe Europe I Antartica I Antartica 2: Bird Species I Date of Birth I Weight I Flying | Exhibit Name I I 1 I I I Y Y Y Eagle Falcon Parrot Emu Swan Mallard Pheasant Thrush Kiwi Treeswift Penguin Bluejay Petrel Goldfinch Gull Ostrich 04:01:2010 03:10:2013 06:21:2000 06:01:2005 07:06:2006 02:26:2008 02:27:2015 07:13:2012 08:17:2015 06:06:2016 03:22:2015 06:13:2013 04:14:2017 07:23:2016 03:20:2010 02:28:2014 I I I ! I I I I I I 10 03 03 80 25 03 92 01 07 01 51 01 02 01 93 50 Americas Americas Australia I Australia Europe I Europe Europe Asia I Australia Asia I Antartica I Americas I Antartica I Americas Antartica Africa I I I I I N Y Y Y Y I I Reptile Species ! Danger Assessment : Date of Birth : Enclosure Size : Exhibit Name I I I I I I I I I Chameleon Monitor Gecko Manba Viper Python Tortoise Crocodile Grass Snake 1 Blanus Anaconda Bothrops Turtle Teiidae Skink I N: 0 Y: 4 N: 1 Y:19 Y: 8 N: 7 N: 1 N: 7 N: 2 N: 1 N: 6 Y: 7 N: 1 N: 2 N: 1 I I 07:02:2015 06:15:2014 06:25:2017 08:29:2015 05:01:2010 04:19:2011 09:05:2002 05:20:2010 03:11:2016 06:24:2013 03:29:2016 06:15:2013 08:21:2012 10:22:2013 09:22:2013 01:02:01 Asia 10:05:05 I Asia 01:02:03 I Australia 03:03:04 I Africa 04:03:02 I Australia 03:03:02 L Africa 06:05:03 I Africa 30:30:03 I Africa 02:02:01 I Europe 03:02:01 Europe 10:10:05 Americas 03:03:04 1 Americas 03:02:01 L Americas 03:03:02 Americas 03:02:04 I Australia I I i I I ! I I I Personnel Name : Date of Hire I Job Title ! Exhibit Name I I 1 I 1 Malee Trevor Mohammad Aaron Ana Travis Justin Vincent Billur Jen Logan Ben Miranda Quinton Ron Laura Ashley I 11:09:2005 05:16:2010 09:01:2015 09:05:2002 10:21:2016 11:09:2005 11:10:2004 05:16:2010 11:09:2005 05:16:2010 12:11:2016 06:04:2002 02:06:2000 10:21:2014 06:04:2002 03:05:1999 06:04:2002 Veterinarian Cleaner Keeper Veterinarian Keeper Veterinarian Veterinarian Cleaner Keeper Cleaner Veterinarian Keeper Veterinarian Cleaner Keeper Cleaner Keeper I Africa I Americas Africa Asia | Australia Africa I Africa 1 Americas Africa Americas Europe Antartica America 1 Europe Europe I Antartica I Antartica I 1 I Would you like to search for mannals and personnel in a specific exhibit? (y'! Y' for yes)

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!