Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi there i am stuck on the question number 2.All details is laid out on the paper please kindly help me solve the question Thank

Hi there i am stuck on the question number 2.All details is laid out on the paper please kindly help me solve the question
Thank you image text in transcribed
2. This code simulates a printer queue. (a) Fill in the Printerjob Object (b) Adapt the Queue class so that it stores a queue of Printjobs. (c) Create a Queue. Add two Printjobs to the Queue public class Printer Job private String Filename: private double time; public Printer Job public class Queue private Object data) - New Object (5e): private int count; private int head; public Queue () count = 0; head=0 > } public Printer Job(String fn, double t) public void enqueue (Object value) int tail - (head count) I data.length; data (tail) - value; count 3 } public void setFileName(String fn) 1 public void setTime(double t) > public String getFileName(){ 3 public double getTimeo } public boolean equals(Printer Job ) public Object dequeue ) { Object temp - data [head]; count head - (head. 1) X data.length; return tempi 1 public object peek () { return data (head): 3 public int size () { return count; public boolean 1sEmpty ( return (count - ) 3 > public int compareTo(Printer Job 1) if(time return -13 else if(time - return 0; else return 1; Create Queue. Add two Print Jobs to the queue. public String toString(){ 7/returns a phrase like Tempi.doc was // added to the printer queue at 3.30

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

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions