Question
C++ Program Using Heaps and Stacks to Manage A Printer Queue ****************************************************************************** Rules of Priority for Printer Queue student jobs are done first in, first
C++ Program Using Heaps and Stacks to Manage A Printer Queue
******************************************************************************
Rules of Priority for Printer Queue
student jobs are done first in, first out. But all TA print jobs are done before any student print job, with the TA's print jobs being done first in, first out. And All instructor print jobs were done before any TA print job, with the instructor's print jobs being done first in, first out.
What Needs to Be Done
Write program to manage the printer queue. you must use Heaps and Priority Queues.
The program will display a menu and prompt the user to enter a choice:
Printer queue ========= 1. Add job 2. Print job 3 View jobs 4. Exit Enter choice:
You may assume the user enters 1, 2, 3 or 4. No input validation is required.
If the user chooses 4. Exit, then the program ends. For Othe CHoices see below guide.
Add Job
If the user chooses Add job, then the program asks the user who is requesting the job:
Instructor (I or i) TA (T or t) Student (S or s)
You may assume that the the user enters I, i, T, t, S or s. No input validation is necessary.
The program then adds the print job to the priority queue. The data added reflects who the job is for (instructor, TA or student) and the number of the print job (an incrementing number, starting with 1, then 2, 3, 4, etc.).
Print Job
If the user chooses Print job, if there are any print jobs in the queue, then the program outputs, for the highest priority print job, who the job is for (instructor, TA or student) and the number of the print job. That print job also is removed from the priority queue. However, if there are no print jobs in the queue, then the program outputs: "No print jobs in queue."
View Jobs
If the user chooses Print job, then the program outputs, for each print job in the queue, and in order of priority, who the job is for (instructor, TA or student) and the number of the print job. However, if there are no print jobs in the queue, then the program outputs: "No print jobs in queue."
Number of Jobs
You could use a vector and just allocate elements dynamically. But if you want to use an array, you can choose a large number so you don't run out of job numbers.
Thanks in advance for your help with this.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started