Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Display a menu list as shown in the following inside a do-while loop construct: 1. Display Employee Information 2. Add Employee 0. Exit Capture user

Display a menu list as shown in the following inside a do-while loop construct: 1. Display Employee Information 2. Add Employee 0. Exit Capture user input for the above options. Store to an int variable named "option" Ability to iterate multiple menu choices (until 0 is entered) with required selection construct to direct process flow to the required logic/functionality (using switch). Refer to the comments for each case to identify the functionality required. Display an error message for invalid menu option selections in the default case Initial output information for menu options 1 and 2 is provided with the relevant formatting. You are required to complete the following. - Define the number of employees SIZE to be 2 using the #define directive and inserting it between the library directive and the main function definition (you will increase this value later) - Declare a struct to represent employee data, which has the following information o An identification number stored in an int o Age stored in an int o Salary stored in a double - Define an array of Employee struct's named emp that can hold SIZE elements. Initialize all of the elements and their member variables to be 0. (Hint: You can assign {0} to emp at its definition.) IMPLEMENT EXIT PROGRAM FUNCTIONALITY IN CASE 0 Print the exiting message. > Exiting Employee Data Program. Good Bye!!! < IMPLEMENT DISPLAY FUNCTIONALITY IN CASE 1 Display the elements of the struct emp array. Only display the valid employee data ("Employee ID, Employee Age and Employee Salary"). Do not display any other data. Hint: If the identification number is positive, then it is valid employee data. Use the following formatting in a printf statement: %6d%9d%11.2lf (Employee ID, Employee Age and Employee Salary) After completing the display, enter a newline using a printf statement. IMPLEMENT ADD EMPLOYEE FUNCTIONALITY IN CASE 2 Keep track of the number of valid employees using an int variable. Check if the struct emp array is full. If the array is full, display the following error message. > ERROR!!! Maximum Number of Employees Reached < If the array is not full, accept new employee data ("Employee ID, Employee Age and Employee Salary") as per the program output listed below and store that data in an empty element of the struct emp array. Increment the number of valid employees as required.

- Change the value of SIZE to 4. - Expand the menu list (printing) to include options 3 & 4 after option 2 with the following o Update Employee Salary o Remove Employee - Create two switch-cases for option 3 & 4 after case 2. Do not forget to include break; statements at the end of each case. IMPLEMENT UPDATE EMPLOYEE DATA FUNCTIONALITY IN CASE 3 Display the following initially > Update Employee Salary < > ====================== < Prompt the user for the employee identification number using a do-while loop. While the number is not found in the employee array, keep prompting the user. Once the number is found, display the current salary for the employee with that identification number and prompt the user to input the new salary. Replace the old salary with the input value. IMPLEMENT REMOVE EMPLOYEE FUNCTIONALITY IN CASE 4 Display the following initially > Remove Employee < > =============== < Copy and paste from case 3 the do-while loop that prompts the user for the employee identification number. Once the number is found, display the following message and change the employee identification number to indicate an empty slot. > Employee [REPLACE WITH EMP ID] will be removed < Decrement the valid employee count by one

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions

Question

Define data hierarchy.

Answered: 1 week ago