It can be used to answer the following question (w/c can be difficult to translate in English): “Pang-ilan sa listahan ng babakunahan si ?” If the name of the person does not exist, return a value of -1. Otherwise, the function should return the value of the index (where the ID number of the vaccinee) is stored. For example, if the vaccinee ID corresponding to parameter name was found in index 7 of VID[] array, the function should return 7 . Note that since the indices start with 0, this means that the person is 8th in the sequence of the list of the people scheduled for vaccination.                  TO DO #5: Implement Search_Schedule() as described above.              @param: name_key is the search key     @param: sched containins the  schedule information     @param: VACCINEE[] is the array of structures (containing info about people who will be scheduled for vaccination)             Assume that the VACCINEE[] array is already sorted in ascending order by             ID number which means -- there's no need for you to do any sorting.     @param: n is the actual number of elements in VACCINEE[] where n <= MAXSIZE.        returns  if the person with the name_key was already scheduled for vacinnation              is found, return the corresponding index from the sched data structure;               otherwise, return a value of -1.               */ int Search_Schedule(nameType name_key, schedType sched, vaccineeType VACCINEE[], int n) {     /*          Declare your own local variables.                    Do NOT call printf() or scanf() in this function.      */     /*         HINT: call Search_by_Name().     */         return 888; // Do NOT forget to return a value. You'll need to change 888. }

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter13: Structures
Section: Chapter Questions
Problem 3PP
icon
Related questions
Question

Following are the given struct that can't be changed

    #define MAXSIZE  100
    #define MAXSLOTS 100
    
    // DO NOT change the following typedef
    typedef char String[11];

    // date structure data type
    struct dateTag {
        int month;
        int day;
        int year;
    };

    typedef struct dateTag dateType;

    // schedule structure data type
    struct schedTag {
        dateType date;
        int n_slots_taken;  // number of slots already taken
        int VID[MAXSLOTS];    // VID means Vaccinee ID.  VID[i] stores the ID number of the person to be vaccinated
                            // ex. VID[0] = 102  
                            //     means that the 1st person to be vaccinated during
                            //     schedule is the person with ID number 102.
    };

    typedef struct schedTag schedType;

 

    // name structure data type
    struct nameTag {
        String last;
        String first;
    };

    typedef struct nameTag nameType;

    // vaccinee structure data type
    struct vaccineeTag {
        int ID;            // ID number of the vaccinee, note that this number is system-generated (i.e., not a user input)
        nameType name;     // name of vacinee
        int age;               // age of vacinee
        int bool_frontliner;    // 0 means not frontliner, 1 means frontliner
        int bool_comorbidity;   // 0 means no comorbidity, 1 means with comorbiditity 
        int priority;           // 0 means priority not yet set, 1 to 4 means priority is set 
                                //   where 1 is the highest priority and 4 is the lowest priority
    };

    typedef struct vaccineeTag vaccineeType;

Instructions

int Search_Schedule(nameType name, schedType sched, vaccineeType VACCINEE[], int n)

Implement Search_Schedule() to determine if a person was scheduled for vaccination, and if yes, what is the corresponding sequence number.

It can be used to answer the following question (w/c can be difficult to translate in English):

“Pang-ilan sa listahan ng babakunahan si ?”

If the name of the person does not exist, return a value of -1. Otherwise, the function should return the value of the index (where the ID number of the vaccinee) is stored.

For example, if the vaccinee ID corresponding to parameter name was found in index 7 of VID[] array, the function should return 7

. Note that since the indices start with 0, this means that the person is 8th in the sequence of the list of the people scheduled for vaccination. 

 

 

 

 

 

 

    TO DO #5: Implement Search_Schedule() as described above.
        

    @param: name_key is the search key
    @param: sched containins the  schedule information
    @param: VACCINEE[] is the array of structures (containing info about people who will be scheduled for vaccination)
            Assume that the VACCINEE[] array is already sorted in ascending order by
            ID number which means -- there's no need for you to do any sorting.
    @param: n is the actual number of elements in VACCINEE[] where n <= MAXSIZE.
       returns  if the person with the name_key was already scheduled for vacinnation
             is found, return the corresponding index from the sched data structure; 
             otherwise, return a value of -1.              
*/
int Search_Schedule(nameType name_key, schedType sched, vaccineeType VACCINEE[], int n)
{
    /* 
        Declare your own local variables.        
           Do NOT call printf() or scanf() in this function. 
    */

    /*
        HINT: call Search_by_Name().
    */    
    return 888; // Do NOT forget to return a value. You'll need to change 888.

}

 

Expert Solution
steps

Step by step

Solved in 5 steps with 4 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr