Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 0 5 Process Queue Simulator Objective: WiNrite a program which simulates first come first serve process scheduling using a queue. Process Class. ( 1

Lab 05
Process Queue Simulator
Objective:
WiNrite a program which simulates first come first serve process scheduling using a queue.
Process Class. (10pts)
Create a class and name it exactly Process.
This class has two attributes:
Name: a non-null String, whose default value is none
Completion time: a positive decimal value that indicates how long the process has until it is finished, whose default value is 0.0
Create accessors and mutators for each attribute. Mutators must check for valid values.
This class must have a toString method that returns a type String formatted as:
Process Name: > Completion Time: >
All the above must apply for full credit.
Queue Interface. (10pts)
Create an interface and name it exactly QueueI
The interface must accept a Generic Type.
The interface must have the following method signatures:
Enqueue: A public method that takes in a parameter of the Generic Type returns nothing.
Dequeue: A public method that takes in no parameters and returns the Generic Type.
Peek: A public method that takes in no parameters and returns the Generic Type.
Print: A public method that takes in no parameters and returns nothing.
All the above must apply for full credit.
Linked List Queue Class. (20pts)
Create a class and name it exactly LLQueue
The class must accept a Generic Type.
The class must have the following methods:
Enqueue: This method returns nothing and takes in some generic data that is added to the end of the queue.
Dequeue: This method removes and returns the first elements data of the queue as long as the head is not null.
Peek: Returns the first elements data but doesnt remove the element.
Print: Prints out the entire queue.
All the above must apply for full credit.
Process Scheduler Class. (30pts)
Create a class and name it exactly ProcessScheduler
This class has two properties:
Processes: This is a linked list queue of processes (referred to as process queue). This data structure holds the processes that are waiting to run.
Current Process: This is the currently running process of type Process. This is a separate value that is not contained in the process queue.
The class must have the following methods:
getCurrentProcess: This method takes no parameters and returns the currently running process. Note that this is not the first element of the process queue.
addProcess: Taking in a process via a parameter it either sets the current process if the current process is null or it adds it to the process queue. Also, it doesnt return any values.
runNextProcess: This method dequeues from the process queue and sets that to the current process.
cancelCurrentProcess: The current process is cancelled and is replaced by the first element on the process queue. Make sure that the process is also removed from the process queue after the current process has been set. Neither parameters nor return values are expected for this method.
printProcessQueue: This method should print all of the elements from the process queue.
All the above must apply for full credit.
IN JAVA, NOT PYTHON OR C++
image text in transcribed

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

Database And Expert Systems Applications 24th International Conference Dexa 2013 Prague Czech Republic August 2013 Proceedings Part 2 Lncs 8056

Authors: Hendrik Decker ,Lenka Lhotska ,Sebastian Link ,Josef Basl ,A Min Tjoa

2013th Edition

3642401724, 978-3642401725

More Books

Students also viewed these Databases questions