Printer Job Scheduler
hardQuestion 498Build a class PrintQueue that serves print jobs first-come, first-served, storing each job's name and page count in a queue.
Methods:
- void submit(const string& name, int pages): adds a job to the back.
- string processNext(): removes the front job and returns Printed NAME (P pages), e.g. Printed report (5 pages). With no jobs, returns No jobs and changes nothing.
- int pendingPages() const: total pages still waiting (0 when empty).
- int size() const: jobs still waiting.
Test 1 submits report (5 pages) and photo (7 pages), then prints pendingPages(), processNext(), pendingPages(), size(), processNext(), processNext(), one per line (see Expected Output).
Test 2 starts empty and prints processNext(), size(), pendingPages(); then submits memo (2 pages) and prints processNext() and size():
No jobs
0
0
Printed memo (2 pages)
0
Do NOT write a main function.
Expected output
12 Printed report (5 pages) 7 1 Printed photo (7 pages) No jobs No jobs 0 0 Printed memo (2 pages) 0
= newline. The output ends with a newline, so print one after the last line.
Your output
Run your code to see the output here...