Question: Can someone code this in Java. I need a similar output as shown in the pic. Exercise Use the class PriorityQueue to build a processor

 Can someone code this in Java. I need a similar outputas shown in the pic. Exercise Use the class PriorityQueue to build

Can someone code this in Java. I need a similar output as shown in the pic.

Exercise Use the class PriorityQueue to build a processor scheduler that receives multiple processes with variant priorities. The processor will ask the processor scheduler about the next process to serve. The scheduler should remove the process that has the highest priority. Once the processor is done, the processor asks the scheduler again about the next process to serve and so on. The program ends when all processes are served. For the sake of this assignment we will work on serving 10 processes. You project should contain only 2 classes: Class: Process This class contains 2 data members: ID sequential number (first object id-1, second object id-2,, .etc) Priority- random number from 1 to 100 (higher number higher priority) Hint 1: You can implement an object counter using a static data member Class: P This class has the main method that will call two functions 1. GenerateProcesses: This function will create 10 processes. Each process will be chedulerTest assigned a priority number that is a random number from 1 to 100. Each process object is added to the PriorityQueue. The information about the processes objects should be printed out as shown in the following Figure. Hint 2: To generate a random number in Java you can use the Math.Random class. EMile aXlk: https://www.geekstorgeeks.org/generating-random-numbers-in-javal 2. ServerProcesses: This function represents the processor that serves the processes in the Priority Queue. The queue will serve the process that has the highest priority. The order of serving the processes should also be printed out as shown in the following Figure

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!