CJCoding With Joseph
15free / daySign inCreate account

Serve the Print Queue

PrintQueue holds waiting job names in a java.util.Queue so the printer serves them in submission order. submit(String) and size() are written.

Requirements:
1. Complete serveAll() so it removes every waiting job and returns their names in arrival order, separated by a comma and a space.
2. Return an empty string when nothing is waiting.
3. The queue must be empty when serveAll() returns.

Do NOT write a main method.

Expected Output:

3
report.pdf, photo.png, notes.txt
0

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
Data Structures & AlgorithmsQueues
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.