← Back to Data Structures & Algorithms
Question 424
Serve the Print Queue
Serve the Print Queue
PrintQueue holds waiting job names in ajava.util.Queueso the printer serves them in submission order.submit(String)andsize()are written. Requirements: 1. CompleteserveAll()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 whenserveAll()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
Sign in to use hintsTopics:
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.