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, 21.06.2019 16:00
This statement accurately describes how headlines should be placed in business documents.
Answers: 3
question
Computers and Technology, 21.06.2019 22:00
Which one of the following identifies the primary a purpose of information classification processes? a. define the requirements for protecting sensitive data.b. define the requirements for backing up data.c. define the requirements for storing data.d. define the requirements for transmitting data.
Answers: 2
question
Computers and Technology, 24.06.2019 12:00
Match the function to its purpose. fast worth 50pts.
Answers: 1
question
Computers and Technology, 24.06.2019 14:30
Two students are discussing electricity that has a frequency of 60 hz. student a says that this type of electricity is referred to as ac. student b says that in this type of electricity, the electrons flow in only one direction. which of the following statements is correct? a. only student a is correct b. only student b is correct c. both of the two students are correct d. neither of the two students is correct
Answers: 1
You know the right answer?
You are given a partially completed program that creates a list of patients, like patients' record./...
Questions
question
Mathematics, 05.10.2020 15:01
question
Mathematics, 05.10.2020 15:01
question
Mathematics, 05.10.2020 15:01
question
Biology, 05.10.2020 15:01
question
Mathematics, 05.10.2020 15:01
Questions on the website: 13722361