Please fill in the blanks for C, from 1 to 68.
/*The 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;
}
#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*/
struct employee getEmployeeInfo();
void printEmployeeInfo(struct employee em);
struct client getClientInfo(int i);
void printClientInfo(struct client cli, int 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). */
struct employee
{
char first_name[length];
char last_name[length];
char title[length];
int num_clients;
double 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).*/
struct client
{
char first_name[length];
char last_name[length];
int clientID;
int age;
};
/*EMPLOYEE
This function get an employee's info,
save it to the employee struct, and
return the employee struct*/
struct employee getEmployeeInfo()
{
struct employee emp;
printf("\nNeed 2 values. Enter the employee full name (first, then last): ");
scanf(" %s %s",emp.first_name, emp.last_name);
printf("Enter the employee's title: ");
scanf("%s",emp.title);
printf("Need 2 numbers. Enter the number of clients, then years of employment:");
scanf("%d %lf", &emp.num_clients, &emp.num_yrs_worked);
return emp;
}
/*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.*/
void printEmployeeInfo(struct employee 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:%d.\n", em.num_clients);
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*/
struct client 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(" %s %s",cli.first_name, cli.last_name);
printf("Need 2 numbers. Enter your client ID, followed by your age: ");
scanf("%d %d",&cli.clientID, &cli.age);
return cli;
}
/*This function takes an client struct and print their info:
Ex: Hello first_name last_name. Client ID: abc. Age: xyz. */
void printClientInfo(struct client cli, int i)
{
printf("\n------------------------\n");
printf("Printing Client #%d info: ", i+1);
printf("\nHello %s %s.\n", cli.first_name, cli.last_name);
printf("ClientID: %d.\n", cli.clientID);
printf("Age: %d.", cli.age);
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*/
my_emp = getEmployeeInfo();
printEmployeeInfo(my_emp);
/*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 < my_emp.num_clients; i ++)
{
my_cli = getClientInfo(i);
printClientInfo(my_cli, i);
}
printf("\n\nThank you for your patience. You have a great day :)\n");
return 0;
}
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
- Write in C++ Write a program to declare and populate the four arrays listed below. You will be required to write the entire program, including headers and the main() function. distance - an array of 10 integers in increasing order starting from 5 and incrementing by one cities - an array of the strings “Boulder”, “NYC”, “LA", “Chicago”, and “Houston”, in that order. sequence - an array of the first 100 integers that are divisible by 6 in order 6, 12, 18, 24, … etc. letters - an array of all uppercase and lowercase characters in order, A, a, B, b, C, c, … Hint: the ASCII table will be helpful here! In order to test that you correctly created and populated the arrays, print the values of each of their elements, in order, one element per line. Note: You are required to use a loop for distance, sequence and letters arrays. Use of individual cout or assignment statements for these three arrays will receive a 0.arrow_forwardPlease write in carrow_forwardThis is matlabarrow_forward
- In C Programming: You will need all the functions from the previous assignment, as well as the structure course:• Department (string, 15 characters)• Course number (integer, 4 digits, leading 0 if necessary)• Course title (string, 30 characters)• Credits (short, 1 digit) Write a function saveAllCoursesText() which receives an array of course pointers and the array’s size, then outputs the content of the array in text format to a file named “courses.txt”.• Save the entire structure on 1 line (all the members of the structure should be saved in 1 fprintf() command)arrow_forwardPrograming language is Carrow_forwardWrite in C++ Sam is making a list of his favorite Pokemon. However, he changes his mind a lot. Help Sam write a function insertAfter() that takes five parameters and inserts the name of a Pokemon right after a specific index. Function specifications Name: insertAfter() Parameters (Your function should accept these parameters IN THIS ORDER): input_strings string: The array containing strings num_elements int: The number of elements that are currently stored in the array arr_size int: The number of elements that can be stored in the array index int: The location to insert a new string. Note that the new string should be inserted after this location. string_to_insert string: The new string to be inserted into the array Return Value: bool: true: If the string is successfully inserted into the array false: If the array is full If the index value exceeds the size of the arrayarrow_forward
- C#arrow_forwardC++ Get a value from the user and using a loop, search for the value in the array. Report all the index locations where it is found Report if it is not found anywhere This is part 4 of an ongoing assignment RandArray which consisted of assigning 20 integers with a random value. I am not sure how to write this out so it matches the output ( in the attached pictures ). I have attached the starter code to this problem as well as my code for part 3 which was correct. Thank you ( STARTER CODE ) #include <iostream>using namespace std; #include <cstdlib> // required for rand() int main(){// Put Part3 code here //Part 4// ask cout << "Enter value to find: ";// look through the array. // If it is found:// print // Found 55 at index 12 // if it is not found after looking at all the elements, // print // 0 is not found in randArray } _______________________________________________________________________ ( PART 3 CODE ) #include <iostream> using…arrow_forwardWrite a menu-driven C++ program to manage your college course history and plans, named as you wish. It should work something like this: Array size: 0, capacity: 2MENUA Add a courseL List all coursesC Arrange by courseY arrange by YearU arrange by UnitsG arrange by GradeQ Quit...your choice: a[ENTER]Enter a courses' name: Comsc-165[ENTER]Enter the year for Comsc-165 [like 2020]: 2016[ENTER]Enter the units for Comsc-165 [0, 1, 2,...]: 4[ENTER]Enter the grade for Comsc-165 [A, B,..., X if still in progress or planned]: x[ENTER]Array size: 1, capacity: 2MENUA Add a courseL List all coursesC Arrange by courseY arrange by YearU arrange by UnitsG arrange by GradeQ Quit...your choice: a[ENTER]Enter a courses' name: Comsc-110[ENTER]Enter the year for Comsc-110 [like 2020]: 2015[ENTER]Enter the units for Comsc-110 [0, 1, 2,...]: 4[ENTER]Enter the grade for Comsc-110 [A, B,..., X if still in progress or planned]: A[ENTER]Array size: 2, capacity: 2MENUA Add a courseL List all coursesC Arrange by…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education