1. Create a class called JobQueue that includes the following fields and functionality: Field jobQueue numJobs...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Create a class called JobQueue that includes the following fields and functionality: Field jobQueue numJobs maxNumJobs Description The field that stores the queue or a pointer to the queue containing job IDs The number of jobs in the queue The maximum number of jobs the queue can have Function Description Decide if you need to use any parameters Constructors Destructors bool isEmpty() const bool isFull() const int getNumJobs () const int getMaxNumJobs () const void print() bool addJob(unsigned int) unsigned int serveJob() void clearQueue() Checks if printer queue is empty Checks if printer queue is full Returns the number of jobs waiting in the queue Returns the maximum possible size of the queue Prints the queue in the order of arrival on the console Adds the job ID to the queue Dequeues the printer queue and returns the job ID Empties the queue You may use your own implementation of a queue http://www.cplusplus.com/reference/queue/queue/ or use the STL queue: 2. Design and implement a class to mimic a list of printers. Each printer should have a status with values as either "busy" or "free". The class should have the following functionalities: Function Parameters/Returns Description getNumPrinters getNumFreePrinters Returns the number of printers in the system Returns the number of "free" printers in the system Sets the printer to status "busy". Throws an error if the printer is already "busy". Sets the printer to status "free". Throws an error if the printer is already "free". usePrinter Parameter: Printer index/pointer freePrinter Parameter: Printer index/pointer You may choose to implement this using any data structure or data type. Clearly state your design decisions and assumptions in a file called PrinterList.pdf. 3. Test the functionality of your printer queue application. Your code should be able to handle the following test case: a. Create a job queue of maximum size 5 b. Create a printer list with 2 printers (e.g., A and B) c. Add job IDs 1 and 2 to the job queue d. Use printer B for dequeued job e. Add jobs 3 and 4 to the job queue f. Use printer A for dequeued job g. Free printer B h. Use printer B for dequeued job 1. Create a class called JobQueue that includes the following fields and functionality: Field jobQueue numJobs maxNumJobs Description The field that stores the queue or a pointer to the queue containing job IDs The number of jobs in the queue The maximum number of jobs the queue can have Function Description Decide if you need to use any parameters Constructors Destructors bool isEmpty() const bool isFull() const int getNumJobs () const int getMaxNumJobs () const void print() bool addJob(unsigned int) unsigned int serveJob() void clearQueue() Checks if printer queue is empty Checks if printer queue is full Returns the number of jobs waiting in the queue Returns the maximum possible size of the queue Prints the queue in the order of arrival on the console Adds the job ID to the queue Dequeues the printer queue and returns the job ID Empties the queue You may use your own implementation of a queue http://www.cplusplus.com/reference/queue/queue/ or use the STL queue: 2. Design and implement a class to mimic a list of printers. Each printer should have a status with values as either "busy" or "free". The class should have the following functionalities: Function Parameters/Returns Description getNumPrinters getNumFreePrinters Returns the number of printers in the system Returns the number of "free" printers in the system Sets the printer to status "busy". Throws an error if the printer is already "busy". Sets the printer to status "free". Throws an error if the printer is already "free". usePrinter Parameter: Printer index/pointer freePrinter Parameter: Printer index/pointer You may choose to implement this using any data structure or data type. Clearly state your design decisions and assumptions in a file called PrinterList.pdf. 3. Test the functionality of your printer queue application. Your code should be able to handle the following test case: a. Create a job queue of maximum size 5 b. Create a printer list with 2 printers (e.g., A and B) c. Add job IDs 1 and 2 to the job queue d. Use printer B for dequeued job e. Add jobs 3 and 4 to the job queue f. Use printer A for dequeued job g. Free printer B h. Use printer B for dequeued job
Expert Answer:
Answer rating: 100% (QA)
include include using namespace std class JobQueue private que... View the full answer
Related Book For
Posted Date:
Students also viewed these computer engineering questions
-
Create an Executive Summary that includes the following information regarding any enterprise: A description of the enterprise, the industry sector, product(s), and intended market an overview of the...
-
Create a class called FooBar which contains one instance variable of type int and another instance variable of type boolean. Create a single constructor which initializes both instance variables, and...
-
Create a class called Heater, that contains four fields, temperature, increment, max and min, all of whose type is double. Make sure you write a description of your new Class in the comments, with...
-
Classify these equations according to their order, degree, type and linearity. Order Degree IV DV Linearity
-
The Township of Langley borrowed $300 000 for road improvements. The debt agreement requires that the township pay the interest on the loan at the end of each year and make equal deposits at the time...
-
Mathematically, why can't a single diverging lens produce a real image?
-
Sol & Nieve is a sporting good and outdoor gear retailer that operates in North America and Central America. In an attempt to characterize its stores and reassess Sol & Nieves supply chain...
-
Equipment acquired on January 8, 2011, at a cost of $420,000, has an estimated useful life of 15 years, has an estimated residual value of $30,000, and is depreciated by the straight-line method. a....
-
Emboldened by the growing online presence of their fellow white supremacists, the organizers of the 2017 Unite the Right rally expanded their activities this year. This year's rally spanned 10 days...
-
1) Read case study and assess the given informatio nin it. Identify at least three significant assertions, WCGWs and explain how these assertions might be at risk. Develop an audit strategy memo that...
-
Describe how an automatic sprinkler system can assist firefighters with fire extinguishment, and how does a fire engine connect to pump to the system?
-
Do you have a Facebook, Twitter, or related account? Is there anything posted in your profile that you think could potentially harm your credibility as a professional?
-
Draw the current organizational structure of Beck Consulting Corporation (BCC). Have designations for 38 people. How is this organizational chart similar to or different from other organizational...
-
Terms of Engagement3:32 minutes https://www.youtube.com/watch?v=O5-kI67mSAE Berrett-Koehler Publisherss Change Authors series focuses on four principles: widening the circle of involvement,...
-
LeadersAngle Gene Deszca Organisational Change14:59 minutes https://www.youtube.com/watch?v=n9lzudH-uJI Evaluate yourself on the core competencies mentioned in the video. What do you think that you...
-
Calculate the break-even level of output.
-
solve lim x-5 x+5 x - 25
-
Solve each problem. Find the coordinates of the points of intersection of the line y = 2 and the circle with center at (4, 5) and radius 4.
-
A hollow conducting cylinder has inner radius a and outer radius b and carries current I along the positive z-direction. Find H everywhere.
-
Calculate the total charge due to the charge distributions labeled A, B, C infigure. x=-2 P.=I mC/m PL 2 mC/m -5 P. 5 mC/m?
-
Determine the normalized input impedance at A/8 from the load if: (a) Its normalized impedance is 2 + j, (b) Its normalized admittance is 0.2 j0.5, (c) The reflection coefficient at the load is 0.3...
-
The position of a particle undergoing simple harmonic motion is given by \(x(t)=20 \cos (8 \pi t)\), where \(x\) is in millimeters and \(t\) is in seconds. For this motion, what are the (a)...
-
Fill in the blanks to make the following statements correct. a. It is difficult to compare two or more data series when absolute numbers and different units are used. For that reason we construct...
-
Fill in the blanks to make the following statements correct. a. On a graph with Y on the vertical axis and X on the horizontal axis, the slope of a straight line is calculated as ___________. b. In...
Study smarter with the SolutionInn App