I need help in constructing the function (indicated in the bold and italics present in the end). Following are the given struct that can't be changed     // 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 void Set_Priority(vaccineeType *ptr_vaccinee) Implement Set_Priority() which will determine and store the value of the structure member priority. Assume that the priority member contains a value of 0 (which means it is not yet determined) before the call to Set_Priority(). Note that you’ll need to access the structure members indirectly via the structure pointer ptr_vaccinee formal parameter. Vaccinees are categorized based on a predetermined priority scheme shown in the table below: Priority (1 is the highest, 4 is the lowest) Condition 1 person is a frontliner 2 person is a senior citizen, i.e., the age is 60 or above 3 person has comorbidity (note: the actual comorbidity is not included in the data) 4 none of the above It is possible that a person can be a frontliner, a senior citizen and has comorbidity, the priority will be 1. If the person is a senior citizen, and has comorbidity, the priority is 2. Some examples are given below with reference to the sample data in Figure 1: Example #1: The priority of SANTOS, JOSE (age 45, not a frontliner, no comorbidity) will be set to 4. Example #2: The priority of ORTIZ, MANNY (age 62, imagine he’s a medical doctor, and with comorbidity) will be set to 1. Example #3: The priority of ALONZO, LUISA (age 65, not a frontliner, and with comorbidity) will be set to 2. Example #4: The priority of CRUZ, JAIME (age 38, not a frontliner, and with comorbidity) will be set to 3. The figure below shows the updated VACCINEE[] contents with the priority values (in bold font) set accordingly.   Index  Element (structure) contents 0 101 SANTOS JOSE 45 0 0 4 1 102 ORTIZ MANNY 62 1 1 1 2 103 ALONZO LUISA 65 0 1 2 .   .   12 112 CRUZ CORNELIA 50 0 1 3 13 114 SY ALEXA 33 1 0 1 14  115 CRUZ JAIME 38 0 1 3 /*     TO DO #2: Implement Set_Priority() as described in the problem specs.                You'll have to acccess the structure members indirectly via the formal      structure pointer parameter ptr_vaccine.     NOTE: Set_Priority() is called inside the Prioritize() function.             See test_functions.c.     @param: ptr_vaccine contains the memory address of a variable containing             data about a vaccinee    returns: none (no return value) */ void Set_Priority(vaccineeType *ptr_vaccinee) {     /*          Declare your own local variables.                    Do NOT call printf() or scanf() in this function.      */     }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I need help in constructing the function (indicated in the bold and italics present in the end).

Following are the given struct that can't be changed

    // 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

void Set_Priority(vaccineeType *ptr_vaccinee)
Implement Set_Priority() which will determine and store the value of the structure member priority. Assume that the
priority member contains a value of 0 (which means it is not yet determined) before the call to Set_Priority(). Note that you’ll need to access the structure members indirectly via the structure pointer ptr_vaccinee formal parameter.
Vaccinees are categorized based on a predetermined priority scheme shown in the table below:
Priority (1 is the highest, 4 is the lowest) Condition

1 person is a frontliner
2 person is a senior citizen, i.e., the age is 60 or above
3 person has comorbidity (note: the actual comorbidity is not included in the data)
4 none of the above

It is possible that a person can be a frontliner, a senior citizen and has comorbidity, the priority will be 1. If the person is a senior citizen, and has comorbidity, the priority is 2. Some examples are given below with reference to the sample data in Figure 1:
Example #1: The priority of SANTOS, JOSE (age 45, not a frontliner, no comorbidity) will be set to 4.
Example #2: The priority of ORTIZ, MANNY (age 62, imagine he’s a medical doctor, and with comorbidity) will be set to 1.
Example #3: The priority of ALONZO, LUISA (age 65, not a frontliner, and with comorbidity) will be set to 2.
Example #4: The priority of CRUZ, JAIME (age 38, not a frontliner, and with comorbidity) will be set to 3.
The figure below shows the updated VACCINEE[] contents with the priority values (in bold font) set accordingly.

 

Index  Element (structure) contents
0 101 SANTOS JOSE 45 0 0 4
1 102 ORTIZ MANNY 62 1 1 1
2 103 ALONZO LUISA 65 0 1 2
.  
.  
12 112 CRUZ CORNELIA 50 0 1 3
13 114 SY ALEXA 33 1 0 1
14  115 CRUZ JAIME 38 0 1 3

/*
    TO DO #2: Implement Set_Priority() as described in the problem specs. 
         
    You'll have to acccess the structure members indirectly via the formal 
    structure pointer parameter ptr_vaccine.

    NOTE: Set_Priority() is called inside the Prioritize() function.  
          See test_functions.c.

    @param: ptr_vaccine contains the memory address of a variable containing
            data about a vaccinee
   returns: none (no return value)
*/
void Set_Priority(vaccineeType *ptr_vaccinee)
{
    /* 
        Declare your own local variables.        
           Do NOT call printf() or scanf() in this function. 
    */    

}

 

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY