Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Lab Manual For Database Development

Authors: Rachelle Reese

1st Custom Edition

1256741736, 978-1256741732

More Books

Students also viewed these Databases questions

Question

=+ For what reasons can and do unions go on strike?

Answered: 1 week ago

Question

=+ Is secondary industrial action common and/or legal?

Answered: 1 week ago