Please fill in the blanks. Programing language is C.   /*For simplicity, this program will get the information of each client,    and print it right back. We could get the information of all clients first, then print them     all later for better readability using an array of struct.*/ #include #include #define length 70 //assume there's no names longer than 70 /*It's good practice to add all function headers    to the top of the program*/ __1__ __2__ getEmployeeInfo(); __3__ printEmployeeInfo(__4__ __5__ em); __6__ __7__ getClientInfo(__8__ i); __9__ printClientInfo(__10__ __11__ cli, __12__ i); /*Employee struct:     all the arrays use the same constant size defined on top     name-first, last-(string)     title (string)     number of clients (integer)     number of years working at the company(can take decimal points). */ __13__ employee {     __14__ first_name[__15__];     __16__ last_name[__17__];     __18__ title[__19__];     __20__ num_clients;     __21__ num_yrs_worked;//3 and a half year would be 3.5 }; /*Client struct:       name (first, last)       client ID (integer)       age (integer)       number of products purchased (integer).*/ __22__ client {     __23__ first_name[__24__];     __25__ last_name[__26__];     __27__ clientID;     __28__ age; }; /*EMPLOYEE This function get an employee's info,    save it to the employee struct, and    return the employee struct*/ __29__ __30__ getEmployeeInfo() {     struct employee emp;     printf("\nNeed 2 values. Enter the employee full name (first, then last): ");     scanf(" %s %__31__",__32__, emp.last_name);     printf("Enter the employee's title: ");     scanf(" __33__",__34__);     printf("Need 2 numbers. Enter the number of clients, then years of employment:");     scanf("%__35__ %__36__", __37__, __38__);     return __39__; } /*This function takes an employee struct and print their info Ex: Hello first_name last_name. Title: def. Number of clients: abc. #years of employment: xyz.*/ __40__ printEmployeeInfo(__41__ __42__ em) {     printf("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n");     printf("Printing back Employee Info\n");     printf("\nHello %s %s.\nTitle: %s.\n", em.first_name, em.last_name, em.title);     printf("Number of clients:__43__.\n", __44__);     printf("Number years of employment: %.1f.\n", em.num_yrs_worked);     printf("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); } /*CLIENT*/ /*This function take an index, get a client's info and return the client struct*/ __45__ __46__ getClientInfo(int i) {       printf("\nProcessing Client #%d", i+1);     struct client cli;     printf("\nNeed 2 values. Enter the client full name (first, then last): ");     scanf(" __47__ __48__",__49__, __50__);     printf("Need 2 numbers. Enter your client ID, followed by your age: ");     scanf("__51__ __52__",__53__, __54__);     return __55__; } /*This function takes an client struct and print their info: Ex: Hello first_name last_name. Client ID: abc. Age: xyz. */ __56__ printClientInfo(struct client cli, int i) {       printf("\n------------------------\n");     printf("Printing Client #%d info: ", i+1);     printf("\nHello %__57__ %__58__.\n", __59__, cli.last_name);     printf("ClientID: %__60__.\n", __61__);     printf("Age: %__62__.", __63__);     printf("\n------------------------\n"); } //MAIN int main() {     //Create 2 struct for employee, and client in that order     struct employee my_emp;     struct client my_cli;         printf("Hi, I'm here to take some statistics: ");     /*Get and print EMPLOYEE's info*/     __64__ = getEmployeeInfo();     printEmployeeInfo(__65__);     /*Get and print CLIENTs's info      Use \ to break printf to multiple lines without getting errors*/     printf("\n\nNow, let's move on to your client(s). \nAccording to the chart,\ you have %d clients.\n", my_emp.num_clients);     //Going through all the clients, get&print each client's info     for(int i = 0; i < __66__; i ++)     {         __67__ = getClientInfo(i);         printClientInfo(__68__, i);     }         printf("\n\nThank you for your patience. You have a great day :)\n");     return 0; }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Please fill in the blanks. Programing language is C.
 
/*For simplicity, this program will get the information of each client,
   and print it right back.
We could get the information of all clients first, then print them
    all later for better readability using an array of struct.*/
#include<stdio.h>
#include<stdbool.h>

#define length 70 //assume there's no names longer than 70

/*It's good practice to add all function headers
   to the top of the program*/
__1__ __2__ getEmployeeInfo();
__3__ printEmployeeInfo(__4__ __5__ em);
__6__ __7__ getClientInfo(__8__ i);
__9__ printClientInfo(__10__ __11__ cli, __12__ i);


/*Employee struct:
    all the arrays use the same constant size defined on top
    name-first, last-(string)
    title (string)
    number of clients (integer)
    number of years working at the company(can take decimal points). */
__13__ employee
{
    __14__ first_name[__15__];
    __16__ last_name[__17__];
    __18__ title[__19__];
    __20__ num_clients;
    __21__ num_yrs_worked;//3 and a half year would be 3.5
};

/*Client struct:
      name (first, last)
      client ID (integer)
      age (integer)
      number of products purchased (integer).*/
__22__ client
{
    __23__ first_name[__24__];
    __25__ last_name[__26__];
    __27__ clientID;
    __28__ age;
};

/*EMPLOYEE
This function get an employee's info,
   save it to the employee struct, and
   return the employee struct*/
__29__ __30__ getEmployeeInfo()
{
    struct employee emp;

    printf("\nNeed 2 values. Enter the employee full name (first, then last): ");
    scanf(" %s %__31__",__32__, emp.last_name);
    printf("Enter the employee's title: ");
    scanf(" __33__",__34__);
    printf("Need 2 numbers. Enter the number of clients, then years of employment:");
    scanf("%__35__ %__36__", __37__, __38__);

    return __39__;
}

/*This function takes an employee struct and print their info
Ex: Hello first_name last_name. Title: def. Number of clients: abc. #years of employment: xyz.*/
__40__ printEmployeeInfo(__41__ __42__ em)
{
    printf("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n");
    printf("Printing back Employee Info\n");
    printf("\nHello %s %s.\nTitle: %s.\n", em.first_name, em.last_name, em.title);
    printf("Number of clients:__43__.\n", __44__);
    printf("Number years of employment: %.1f.\n", em.num_yrs_worked);
    printf("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
}

/*CLIENT*/
/*This function take an index, get a client's info and return the client struct*/
__45__ __46__ getClientInfo(int i)
{  
    printf("\nProcessing Client #%d", i+1);

    struct client cli;
    printf("\nNeed 2 values. Enter the client full name (first, then last): ");
    scanf(" __47__ __48__",__49__, __50__);
    printf("Need 2 numbers. Enter your client ID, followed by your age: ");
    scanf("__51__ __52__",__53__, __54__);
    return __55__;
}
/*This function takes an client struct and print their info:
Ex: Hello first_name last_name. Client ID: abc. Age: xyz. */
__56__ printClientInfo(struct client cli, int i)
{  
    printf("\n------------------------\n");
    printf("Printing Client #%d info: ", i+1);
    printf("\nHello %__57__ %__58__.\n", __59__, cli.last_name);
    printf("ClientID: %__60__.\n", __61__);
    printf("Age: %__62__.", __63__);
    printf("\n------------------------\n");
}

//MAIN
int main()
{
    //Create 2 struct for employee, and client in that order
    struct employee my_emp;
    struct client my_cli;
   
    printf("Hi, I'm here to take some statistics: ");

    /*Get and print EMPLOYEE's info*/
    __64__ = getEmployeeInfo();
    printEmployeeInfo(__65__);

    /*Get and print CLIENTs's info
     Use \ to break printf to multiple lines without getting errors*/
    printf("\n\nNow, let's move on to your client(s). \nAccording to the chart,\
you have %d clients.\n", my_emp.num_clients);

    //Going through all the clients, get&print each client's info
    for(int i = 0; i < __66__; i ++)
    {
        __67__ = getClientInfo(i);
        printClientInfo(__68__, i);
    }
   
    printf("\n\nThank you for your patience. You have a great day :)\n");
    return 0;
}


Task 3: Struct
You will write a program to keep track of a company's employee and his/her clients. We'll have:
1. TWO structures: the employee and the client.
2. 2 functions for each struct (different structure >>> different number of parameters) to:
Get the information (initialization)
Print back the information
We'll assume there will be only 1 employee. # of clients depends on the user's inputs.
Here's the information needed for each struct:
Employee struct: first name, last name, title, number of clients, and number of years
working at the company (take decimal points).
Client struct: first name, last name, age, client ID, and the number of products purchased.
In main, we'll:
• declare each struct
for each struct, call their corresponding function to get the information, and print it back.
Hint:
Depends on how many clients, you'll need to use loops to get information for all of them
(we'll use for loop in the quiz).
You can get number of clients from the employee.
#define length 50 will create a constant global variable length of size 50 to be used in any
function. Put this line on top of your program.
o For example, char lastName[length] uses length global variable.
• For scanf and printf and the character array, you can use %s instead of %c to get the full
name instead of just the initial ("Bob" vs 'B'). We'll talk about it more next week.
o
For example: char first_name[length]; scanf("%s", first_name) for "Bob".
o Notice there is no & next to first_name. Only for %s when scanning.
•
•
Transcribed Image Text:Task 3: Struct You will write a program to keep track of a company's employee and his/her clients. We'll have: 1. TWO structures: the employee and the client. 2. 2 functions for each struct (different structure >>> different number of parameters) to: Get the information (initialization) Print back the information We'll assume there will be only 1 employee. # of clients depends on the user's inputs. Here's the information needed for each struct: Employee struct: first name, last name, title, number of clients, and number of years working at the company (take decimal points). Client struct: first name, last name, age, client ID, and the number of products purchased. In main, we'll: • declare each struct for each struct, call their corresponding function to get the information, and print it back. Hint: Depends on how many clients, you'll need to use loops to get information for all of them (we'll use for loop in the quiz). You can get number of clients from the employee. #define length 50 will create a constant global variable length of size 50 to be used in any function. Put this line on top of your program. o For example, char lastName[length] uses length global variable. • For scanf and printf and the character array, you can use %s instead of %c to get the full name instead of just the initial ("Bob" vs 'B'). We'll talk about it more next week. o For example: char first_name[length]; scanf("%s", first_name) for "Bob". o Notice there is no & next to first_name. Only for %s when scanning. • •
Expert Solution
steps

Step by step

Solved in 3 steps with 1 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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education