Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package priority;
- import java.util.*;
- public class Priority {
- public static void main(String[] args) {
- PriorityQueue<Integer> line = new PriorityQueue<>();
- Scanner input = new Scanner(System.in);
- System.out.print("how many people are in the line?: ");
- int people = input.nextInt();
- for (int i=0; i < people; i++) {
- System.out.print("What is their ticket number?: ");
- int lines = input.nextInt();
- line.add(lines);
- while (!line.isEmpty())
- System.out.print(line.remove() + " ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement