You are required to write three functions as follows:

populate_employees(Employee emps[], int size)

This function should take an input array of employees whose capacity is size and populate the array with employee information. For each element (employee) in the array, the function generates a random id between 100000 and 999999 and a random years_of_service between 0 and 50.

sort_employees(Employee emps[], int size)

This function should sort the input array based on each employee's years_of_service. You are required to adapt the Selection Sort code presented in Chapter 6 for the implementation of this function. You can find the original code of the Selection Sort on slide 51 of the chapter.

print_employees(Employee emps[], int size)

Display information of all employees in the following format:

ID: *; Years of Service: *

Each employee's information should occupy one line. You should display each employee based on the order in which they appear in the input array.

You are also required to write a main function . The main function should define an Employee array of 20 elements and name it employees. The main function should then complete the following tasks in order:

1) Invoke the populate_employees function to populate the employees array.
2) Invoke print_employees to display the content of employees.
3) Invoke sort_employees to sort employees based on years_of_service.
4) Invoke print_employees to display the content of employees. Note that the array as it is displayed at this step will be in sorted order because of step 3

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.