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 17:40
Gabe wants to move text from one document to another document. he should copy the text, paste the text, and open the new document highlight the text, select the cut command, move to the new document, make sure the cursor is in the correct location, and select the paste command select the save as command, navigate to the new document, and click save highlight the text, open the new document, and press ctrl and v
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Which of the following would not be considered a pc? a. mainframe b. desktop c. tablet pc d. laptop
Answers: 2
question
Computers and Technology, 23.06.2019 18:50
Ais a picture icon that is a direct link to a file or folder
Answers: 1
question
Computers and Technology, 24.06.2019 14:30
Which computer network component connects two different networks together and allows them to communicate? a is a node (or a device) that connects two different networks together and allows them to communicate.
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
SAT, 05.05.2021 14:00
question
Biology, 05.05.2021 14:00
question
Mathematics, 05.05.2021 14:00
question
Mathematics, 05.05.2021 14:00
question
Mathematics, 05.05.2021 14:00
question
Mathematics, 05.05.2021 14:00
Questions on the website: 13722359