Answered step by step
Verified Expert Solution
Question
1 Approved Answer
do this in java Project Description. A generic ADT Priority queue can be designed and implemented with a generic ADT heap, another abstract data type.
do this in java
Project Description. A generic ADT Priority queue can be designed and implemented with a generic ADT heap, another abstract data type. In this project, you are required to design a generic ADT heap that uses an array list, as the data structure, to store a list of objects, in this project, consider the Employee. Each employee contains two unique values: 1) name : a full name in a format as in "JohnSmith". 2) pay rate: a numeric value indicating the annual income of an employee. Assume we store a list of employees using an ADT priority queue according to their names or their pay rates. Therefore, we need to create two comparators. A name comparator: compares/sorts employees by their names. A pay rate comparator: compares/sorts employees by their pay rates. To organize employees in a priority queue, we first create an empty priority queue with a reference to a comparator passed into the constructor as the ordering for the queue (more accurately for the heap that is used to implement the queue). And then, insert the employees into the queue according to their priority defined in the comparator. If the comparator compares employee names, the name in the root of a heap is greater than the names of its children. If the comparator compares employee pay rates, the pay rate in the root of a heap is greater than the pay rates of its children. To use Employee to test this project, we need to design three classes. Employee .A name comparator for employee, a class implementing the interface java.util.ComparatorStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started