SHARE
TWEET

Untitled

a guest Oct 10th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top