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 07:00
For all machines-not just hammers- the user applies force force to the machine to the machine over a certain distance. a. input b. output c. duo d. none of the above
Answers: 1
question
Computers and Technology, 22.06.2019 11:30
Communication is the exchange of information. true false
Answers: 2
question
Computers and Technology, 22.06.2019 15:30
When creating a budget, log fixed expenses before income. after income. after savings. at the top.
Answers: 1
question
Computers and Technology, 22.06.2019 21:30
The salespeople at hyperactive media sales all use laptop computers so they can take data with them on the road. you are a salesperson for superduper lightspeed computers talking to hyperactive media sales about upgrading the laptops to windows 10. explain how network location awareness in windows 10 would make the laptops more secure.
Answers: 3
You know the right answer?
You are given a partially completed program that creates a list of patients, like patients' record./...
Questions
question
Computers and Technology, 16.12.2019 05:31
question
Chemistry, 16.12.2019 05:31
question
Mathematics, 16.12.2019 05:31