Advertisement
Shamel

Untitled

Nov 5th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.22 KB | None | 0 0
  1.  
  2.  
  3. public class Qlab5 {
  4.  
  5.     public Qlab5() {
  6.     }
  7.    
  8.    
  9. }
  10.  
  11.  
  12. class Registration{
  13.     private PriorityQueue <Student> ogline;
  14.     private Queue <Student> reline;
  15.     class Student implements Comparable{
  16.         private Sring name;
  17.         private int age;
  18.        
  19.         public Student(String n, int a)
  20.         {
  21.             name= n;
  22.             age=a;
  23.         }
  24.        
  25.         public String toString()
  26.         {
  27.             return name+ " " + age;
  28.         }
  29.        
  30.         public int compareTo(int g)
  31.         {
  32.             return a-g;
  33.         }
  34.     }
  35.    
  36.    
  37.    
  38.         public Registration()
  39.     {
  40.         ogline=new LinkedList<Student>();
  41.         reline=new LinkedList<Student>();
  42.     }
  43.    
  44.         public void enterLine()
  45.         {
  46.             Scanner f=new Scanner(System.in);
  47.             String n;
  48.             int g;
  49.             System.out.print("Enter the student's name ==> ");
  50.             n=f.nextLine();
  51.             System.out.print("Enter the student's grade ==> ");
  52.             g=f.nextLine();
  53.             Student student=new Student(n,g);
  54.             ogline.add(student);
  55.         }
  56.        
  57.         public void displayOriginalLine()
  58.         {
  59.             private PriorityQueue <Student> ogline2;
  60.             while(!ogline.isEmpty())
  61.             {
  62.                 ogline2.add(ogline.peek());
  63.                 System.out.print(ogline.remove());
  64.                
  65.             }
  66.            
  67.             while(!ogline2.isEmpty())
  68.             {
  69.                 ogline.add(ogline2.remove());
  70.                
  71.             }
  72.         }
  73.        
  74.         public void disperseLine()
  75.    
  76.    
  77.    
  78.    
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement