Page 623 - Computer science 868 Class 12
P. 623

4       public static void main(String args[])

                   5       {

                   6       Scanner sc = new Scanner(System.in);
                   7       System.out.print("Queue Size");
                   8       Queue ob = new Queue(sc.nextInt());

                   9       String s="";
                   10      do {

                   11      System.out.println("Main Menu");
                   12      System.out.println("Press 1 for enqueue");

                   13      System.out.println("Press 2 for delqueue");
                   14      System.out.println("Press 3 for Display of Queue");

                   15      switch(sc.nextInt())
                   16      {

                   17      case 1:
                   18      System.out.print("Enter Element to be Enqueued");

                   19      ob.enqueue(sc.nextInt());
                   20      break;

                   21      case 2:
                   22      ob.delqueue();

                   23      break;
                   24      case 3:

                   25      ob.display();
                   26      break;

                   27      default:
                   28      System.out.println("Invalid Choice");
                   29      }

                   30      System.out.println("Do you want to continue?(y/n)");

                   31      s=sc.next();
                   32      }
                   33      while(s.equalsIgnoreCase("y"));

                   34      System.out.println("Thank You");
                   35          }

                   36      }







                                                                                                                       621
                                                                                                   Internal Assessment  621
   618   619   620   621   622   623   624   625   626   627   628