Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

I need help in C programming for the following formation of a user defined function.

Given structs 

#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;

 

Create this funcion-

    TO DO #1: Implement Search_by_Name() Implement a linear search algorithm to search the VACCINEE[] list if there is a matching element corresponding to the name_key parameter. If there is a match, return the corresponding array index where it was found in the list. Otherwise, return a value of -1 to indicate that it was not found.

    @param: name_key is the search key (containing the last name and first name of the person to be searched)
    @param: VACCINEE[] is the array of structures (containing info about people who will be scheduled for vaccination)
    @param: n is the actual number of elements in VACCINEE[] where n <= MAXSIZE.
    returns: if name_key is found, return the index where name_key was found in VACCINEE[]; 
             otherwise, return a value of -1.
*/
int
Search_by_Name(nameType name_key, vaccineeType VACCINEE[], int n)
{   
    /* 
        Declare your own local variables.        
           Do NOT call printf() or scanf() in this function. 
    */   
    return 888;  // Do NOT forget to return a value. You'll need to change 888.
}

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education