
The fourth programming project involves modifying the employee database programs that you began in the first three projects. Let's assume, because of limited funds, the rules for awarding bonuses to employees has changed. Instead of giving all employees with ten years of service a bonus, the new rules are that the five salaried employees with the most seniority receive a 10% bonus, the five salaried employees with the next most seniority receive a 5% bonus and all the remaining employees receive none. Hourly employees receive (unfortunately) no bonus. (Seniority means the length of time the employee has worked in the company.)
To solve this problem a priority queue is a natural solution. We can create a priority queue of employees using the length of service as the priority. Priority queues are discussed in section 7.3 of the textbook; no package interface is given in that section, but a useful one, a modification of Queues_Generic, appears as Queues_Generic_Priority. Use this package interface, but change the private part so that the queue is implemented as a singly-linked list instead of an array. Because it is important for you to learn how to do some linked-list programming in this course, do not use the generic list package from Chapter 9, but code the queue operations yourself using ideas you will get from Chapter 8.
In the Employee_UI menu, modify the choice P, to display the employees who will receive bonuses. This choice should print a list of the employee names of the employees receiving the 10% bonus, and how much they will receive, and a second list of those receiving 5%. Also display the total dollar amount of the bonuses. In the code that produces these lists you should use an instantiation of the Queues_Generic_Priority package. There is no need for a queue of whole records, a queue of employee IDs should suffice. You must also write a function Get_Seniority, which should be supplied as a generic actual parameter corresponding to KeyOf.