Advertisement
Guest User

Untitled

a guest
Oct 10th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. package priority;
  2.  
  3. import java.util.*;
  4.  
  5. public class Priority {
  6.  
  7. public static void main(String[] args) {
  8.  
  9. PriorityQueue<Integer> line = new PriorityQueue<>();
  10.  
  11. Scanner input = new Scanner(System.in);
  12.  
  13. System.out.print("how many people are in the line?: ");
  14. int people = input.nextInt();
  15. for (int i=0; i < people; i++) {
  16.  
  17. System.out.print("What is their ticket number?: ");
  18. int lines = input.nextInt();
  19. line.add(lines);
  20.  
  21. while (!line.isEmpty())
  22. System.out.print(line.remove() + " ");
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement