// READ BEFORE YOU START: // You are given a partially completed program that creates a list of pets with their list of checkups. // Each pet has the corresponding information: name, breed, and a linked list of checkups. // To begin, you should trace through the given code and understand how it works. // Please read the instructions above each required function and follow the directions carefully. // If you modify any of the given code, the return types, or the parameters, you risk failing the automated test cases. // // You are to assume that all input is valid: // Valid name: String containing alphabetical letters beginning with a capital letter // Valid breed: String containing alphabetical letters beginning with a capital letter // Valid date: String in the following format: \"MM/DD/YYYY\" ex: \"01/01/2010\" // All input will be a valid length and no more than the allowed amount of memory will be used // // Q1 : CLASS METHODS Part 1 : Constructor and Accessor Methods for Pet class in Pet.cpp file ( 5 points) // Q2 : CLASS METHODS Part 2 : Class methods for Pet class in Pet.cpp file (10 points) // Q3 : Add Function in hw09.cpp file ( 5 points) // Q4 : Search Function in hw09.cpp file (10 points) // Q5 : Remove One Function in hw09.cpp file (15 points) // Q6 : Implement cin / cout for the lines in main without modifying the functionality ( 5 points) #include #include #include #include \"Container.h\" #include \"Pet.h\" #include \"Checkup.h\" using namespace std; // forward declarations void flush(); void branching(char); void helper(char); void add_pet(string, string); Pet* search_pet(string, string); void remove_pet(string, string); void clean_up(Pet*); void print_all(); void remove_all(); Container* list = NULL; // global list int main() { _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); // Use to check for memory leaks in VS char ch = \'i\'; do { // Q6: Implement cin / cout for the lines below without modifying the functionality (5 points) // (change all printf statements to cout and read the next char using cin) printf(\"Please enter your selection\ \"); printf(\"\\ta: add a new pet to the list\ \"); printf(\"\\tc: add a new checkup for a pet\ \"); printf(\"\\tr: remove a pet from the list\ \"); printf(\"\\tp: print all pets on the list\ \"); printf(\"\\tq: quit\ \"); ch = getchar(); // End Q6 flush(); branching(ch); } while (ch != \'q\'); remove_all(); list = NULL; return 0; } void flush() { int c; do c = getchar(); while (c != \'\ \' && c != EOF); } void branching(char c) { switch (c) { case \'a\': case \'c\': case \'r\': case \'p\': helper(c); break; case \'q\': break; default: printf(\"\ Invalid input!\ \ \"); } } // The helper function is used to determine how much data is needed and which function to send that data to. // It uses pointers and values that are returned from some functions to produce the correct ouput. // There is no implementation needed here, but you should study this function and know how it works. //.