Question: You are to develop a simple PrintQueue class using the GenericQueue class. It is modeled similar to the Unix print command. The following is the

You are to develop a simple PrintQueue class using the GenericQueue class. It is modeled similar to the Unix print command. The following is the specification: PrintQueue() Creates an empty print queue void lpr (String owner, int jobId) Enqueues a job with the specified owner name and job id void lpq() Prints all the entries in this queue void lprm(int jobId) Removes the active job at the front of the queue if jobId matches, error message otherwise void lprmAll(String owner) Removes all jobs from the queue that have been submitted by the owner As an example, you can create a print queue pq as follows: swilliams 309 ronaldinho 300 marionjones 312 swilliams 267 7 davidh 135 ronaldinho 301 pq.lprm(309) removes the first entry from the queue pq.lprmAll(ronaldinho) removes all entries of ronaldinho from the queue As can be seen, each item in the queue has two entries: owner: a String jobId: an int So first, you need to create a simple Job class to hold these two entries: public class Job { private String owner; private int jobId; public Job(String o, int j) { owner = o; jobId = j; } public String getOwner() { return owner; } public int getJobId() { return jobId; } } Then complete the following PrintQueue class. Write a demo program to illustrate the various operations of the PrintQueue class. In your demo program, you can prompt the user to enter the jobs and their IDs and then display the various operations.
PrintQueue(0) void lpr (String owner, int jobld) void lpq) void lprm(int jobld) void lprmAll(String owner) Creates an empty print queue Enqueues a job with the specified owner name and job id Prints all the entries in this queue Removes the active job at the front of the queue if jobld matches, error message otherwise Removes all jobs from the queue that have been submitted by the owner As an example, you can create a print queue pq as follows: swilliams ronaldinho marionjones 312 swilliams 309 300 267 davidh ronaldinho 301 pq.lprm(309) -> removes the first entry from the queue pq.lprmAll(ronaldinho) -> removes all entries of ronaldinho from the queue As can be seen, each item in the queue has two entries: owner: a String iobld: an int So first, you need to create a simple Job class to hold these two entries: public class Job PrintQueue(0) void lpr (String owner, int jobld) void lpq) void lprm(int jobld) void lprmAll(String owner) Creates an empty print queue Enqueues a job with the specified owner name and job id Prints all the entries in this queue Removes the active job at the front of the queue if jobld matches, error message otherwise Removes all jobs from the queue that have been submitted by the owner As an example, you can create a print queue pq as follows: swilliams ronaldinho marionjones 312 swilliams 309 300 267 davidh ronaldinho 301 pq.lprm(309) -> removes the first entry from the queue pq.lprmAll(ronaldinho) -> removes all entries of ronaldinho from the queue As can be seen, each item in the queue has two entries: owner: a String iobld: an int So first, you need to create a simple Job class to hold these two entries: public class Job
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
