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 21:30
Felicia wants to become a head surgeon by december 2013. she designs the career milestones that she would need to complete her goal. by june 2013, she was not licensed. which best describes what she should do?
Answers: 2
question
Computers and Technology, 22.06.2019 19:20
Consider the following code snippet: #ifndef cashregister_h#define cashregister_hconst double max_balance = 6000000.0; class cashregister{public: cashregister(); cashregister(double new_balance); void set_balance(double new_balance); double get_balance() const; private: double balance[12]; }; double get_monthly_balance(cashregister bk, int month); #endifwhich of the following is correct? a)the header file is correct as given.b)the definition of max_balance should be removed since header files should not contain constants.c)the definition of cashregister should be removed since header files should not contain class definitions.d)the body of the get_monthly_balance function should be added to the header file.
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Visually impaired individuals generally rely on the for navigation. thus, designers need to ensure that mouse-specific inputs, such as pointing, clicking, and hovering, can be done without a mouse.
Answers: 1
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
You know the right answer?
You are given a partially completed program that creates a list of patients, like patients' record./...
Questions
question
Mathematics, 14.06.2021 02:40
question
Mathematics, 14.06.2021 02:40
question
Mathematics, 14.06.2021 02:40
question
Biology, 14.06.2021 02:40
Questions on the website: 13722367