subject

You are given a partially completed program that creates a list of patients, like patients' record.// Each record has this information: employee's name, supervisors's name, department of the employee, room number.// The struct 'employeeRecord' holds information of one employee. Department is enum type.// An array of structs called 'list' is made to hold the list of employees.// To begin, you should trace through the given code and understand how it works.// Please read the instructions above each required function and follow the directions carefully.// You should not modify any of the given code, the return types, or the parameters, you risk getting compile error.// You are not allowed to modify main ().// You can use string library functions. int main(){ char* fileName = "Employee_List. txt"; load(fileName); // load list of employees from file (if it exists). Initially there will be no file. char choice = 'i'; // initialized to a dummy value do { printf("\nEnter your selection:\n"); printf("\t a: add a new employee\n"); printf("\t d: display employee list\n"); printf("\t r: remove an employee from list\n"); printf("\t s: sort employee list by ID\n"); printf("\t q: quit\n"); choice = getchar(); flushStdIn(); executeAction(choice); } while (choice != 'q'); save(fileName); // save list of employees to file (overwrites file, if it exists) return 0;}// flush out leftover '\n' charactersvoid flushStdIn(){ char c; do c = getchar(); while (c != '\n' && c != EOF);}// ask for details from user for the given selection and perform that actionvoid executeAction(char c){ char employeeName_input[MAX_NAME_LENGTH] , supervisorName_input[MAX_NAME_LENGT H]; unsigned int roomNumber_input, idNumber_input, add_result= 0; char department_input[20]; switch (c) { case 'a': // input employee record from user printf("\nEnter employee name: "); fgets(employeeName_input, sizeof(employeeName_input), stdin); employeeName_input[strlen(employeeN ame_input) - 1] = '\0'; // discard the trailing '\n' char printf("Enter supervisor name: "); fgets(supervisorName_input, sizeof(supervisorName_input), stdin); supervisorName_input[strlen(supervi sorName_input) - 1] = '\0'; // discard the trailing '\n' char printf("Enter whether employee is in 'HR' or 'Marketing' or 'IT': "); fgets(department_input, sizeof(department_input), stdin); department_input[strlen(department_ input) - 1] = '\0'; // discard the trailing '\n' char printf("Please enter employee ID number: "); scanf("%d", &idNumber_input); printf("Please enter room number: "); scanf("%d", &roomNumber_input); flushStdIn(); // add the employee to the list add_result = add(employeeName_input, supervisorName_input, department_input, idNumber_input, roomNumber_input); if (add_result == 0) printf("\nEmployee is already on the list! \n\n"); else if (add_result == 1) printf("\nEmployee successfully added to the list! \n\n"); else printf("\nUnable to add. Employee list is full! \n\n"); break; case 'r': printf("Please enter ID number of employee to be deleted: "); scanf("%d", &idNumber_input); flushStdIn(); int delete_result = delete(idNumber_input); if (delete_result == 0) printf("\nEmployee not found in the list! \n\n"); else printf("\nEmployee deleted successfully! \n\n"); break; case 'd': display(); break; case 's': sort(); break; case 'q': break; default: printf("%c is invalid input!\n", c);

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:00
When is it appropriate to use an absolute reference
Answers: 1
question
Computers and Technology, 22.06.2019 21:30
This graph compares the total cost of attending educational institutions in texas. the graph demonstrates that the cost at private and public technical schools greatly varies.
Answers: 2
question
Computers and Technology, 23.06.2019 21:00
Alcohol’s affects on the cornea and lens of the eye make it more difficult
Answers: 1
question
Computers and Technology, 24.06.2019 00:30
Use the keyword strategy to remember the meaning of the following word. the meaning for the word has been provided. write your keyword and describe the picture you would create in your mind. obfuscate: to make something so confusing that it is difficult to understand.
Answers: 2
You know the right answer?
You are given a partially completed program that creates a list of patients, like patients' record./...
Questions
question
Geography, 31.03.2020 20:22
question
Mathematics, 31.03.2020 20:23
Questions on the website: 13722363