Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 3 (10%): Write your mainfunction. . Declare a Zoo object in your main()

ID: 669120 • Letter: Q

Question

Question 3 (10%): Write your mainfunction. . Declare a Zoo object in your main(). . Read from the file ^''importfile.txt,^'' and store each line into the vector/array of your Zoo object. Print the results to an output file. (Your code must be able to handle the dummy line). . Append your favorite animal to the vector/array in the Zoo object. Print the results to an output file. . Remove the last element from the vector/array in the Zoo object. Print the results to an output file. . Sort the elements in the vector/array in the Zoo object. Print the results to an output file. Finish the Questions 1-3 before working on the questions below Question 4 (5%): Find the median in the vector/array from your Zoo class based on the number of legs of the Animal objects. . Write a function in your Zoo class that finds the median. Call the function in your main. Print the result to an output file. Question 5 (5%): Find all the Animals in the vector/array in your Zoo class that have less than 4 legs. Hint: This is easier if you write it with 1 function that takes of stream as a parameter. . Write a function in your Zoo class that finds all the animals with less than 4 legs, call the function in your main and print it to an output file. Question 6 (5%): Sort the animals in the vector/array in your Zoo class alphabetically. Hint: There is a reason I made sure every animal began with a different letter. Hint: Look up Ascii code. Notice that the character ^'A^' is less than ^'B^' . Write a separate sort function in your Zoo that sorts the Animals in the vector/array alphabetically. . Call this function in your main and print the results to an output file.

Explanation / Answer

// bears lions zebras gorrilas monkeys, oh my! // A zoo class program using classes (duh) and // inharitance #include #include using namespace std; string animalTypes[10]= { "Tiger", "Elephant", "", // have not come up with the rest of the animals yet, but "", // irrelevant to this problem "", "", "", "", "", }; class Animal { public: string name; Animal(int n_type); // the constructer protected: int hunger; bool sick; int age; int type; // this will be a number that will be used in animalType. i.e. a tiger would be 0 string nameoftype; }; Animal::Animal(int n_type) { cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote