in JAVA PLEASE SHOW OUTPUT!
- PriorityQueueUserDefinedObjectExample(20)
Create an Employee class which implementsComparable
The constructor consists of an employee’s first name and anemployee’s salary, both of which are instance variables.
Create accessor and mutator methods for both of thesevariables
Write an equals method that returns true if the salaries areequal with one cent and the names are exactly equal
Write a compareTo method that returns 1 if the salary of thisemployee is greater than the salary of the comparable, -1 if lessthan and 0 if equal.
Create a class called PriorityQueueUserDefinedObjectExample
Create a Scanner to read from the user input.
Create a Scanner and a PrintWriter to read to a file and outputto a different file. (note: You should prompt for the names ofthese files).
The input file has a single name followed by a 5 or 6 figuresalary on each line. (You can use my empsalaries.txt in thehomework for Lesson 7)
Create a PriorityQueue
Read in and add each employee to the queue
Use the remove method as you write the employee and salary tothe output file from lowest salary to highest.
See sample input file empsalaries.txt and output filepriorityemp.txt
//empsalaries
James 1000000.42Oscar 7654321.89Jose 352109.00Daniel 98476.22Juan 452198.70Sean 221133.55Ryan 1854123.77
//priorityemp
NAME SALARY Daniel $ 98476.22 Sean $221133.55 Jose $352109.00 Juan $452198.70 James $1000000.42 Ryan $1854123.77 Oscar $7654321.89