Write a simulator to manage print jobs. A print job will be processed in the order of submission (you must make sure this is the only order possible for your program), and there are 2 printers, red and green.

computer science

Description

Write a simulator to manage print jobs. A print job will be processed in the order of submission (you must make sure this is the only order possible for your program), and there are 2 printers, red and green. All the printers print at the same rate. Each print job has a number of pages, and will tie up a printer for that number of cycles. A cycle is the time it takes to print one page. Write a program that will use your class that can, reading from standard input:

Call your program printerSimulation(). This how we will invoke it in eSubmit. Your solution will also need to implement a printer class that accepts print jobs (removed from the queue). You will also need to monitor (in some fashion) the state of the printer (free, busy, pages to print?). The printer can only handle one print job at a time. In this assignment, if both printers are free and there is a print available, it should choose the red printer. These marks will be allocated by the eSubmit testing. Make sure your program agrees with the test program.


So for example, if there are 3 jobs, job 1 (5 pages), job 2 (7 pages) and job 3(13 pages), after 6 cycles (printed pages), one printer (green) would have job 2 on it with 1 page left, and the other (red) would have job 3 on it with 12 pages left.


You will use a linked queue that will be used for all the print jobs (the printers get new jobs from the queue when they are not processing a job).


You will also need to test and document your classes (and program). Include comments about the classes, their data member, and member functions. Also, you will need to provide a test() function that is designed to test your classes; you will have at least two classes – the queue and the printer. We will not test your classes directly, but will look at your code, comments, and the output from the test() function. These marks are determined by inspecting your code and the output generated by your test() function, so ensure that it tests everything adequately.


Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.