| 8 | import java.util.Scanner; |
| 9 | |
| 10 | public class Demo |
| 11 | { |
| 12 | public static void main(String[] args) |
| 13 | { |
| 14 | int choice,x; |
| 15 | Scanner scan = new Scanner(System.in); |
| 16 | |
| 17 | QueueA qu = new QueueA(8); |
| 18 | |
| 19 | while(true) |
| 20 | { |
| 21 | System.out.println("1.Insert an element in the queue"); |
| 22 | System.out.println("2.Delete an element from the queue"); |
| 23 | System.out.println("3.Display element at the front"); |
| 24 | System.out.println("4.Display all elements of the queue"); |
| 25 | System.out.println("5.Display size of the queue"); |
| 26 | System.out.println("6.Quit"); |
| 27 | System.out.print("Enter your choice : "); |
| 28 | choice = scan.nextInt(); |
| 29 | if(choice==6) |
| 30 | break; |
| 31 | |
| 32 | switch(choice) |
| 33 | { |
| 34 | case 1: |
| 35 | System.out.print("Enter the element to be inserted : "); |
| 36 | x = scan.nextInt(); |
| 37 | qu.insert(x); |
| 38 | break; |
| 39 | case 2: |
| 40 | x=qu.Delete(); |
| 41 | System.out.println("Element deleted is : " + x); |
| 42 | break; |
| 43 | case 3: |
| 44 | System.out.println("Element at the front is : " + qu.peek()); |
| 45 | break; |
| 46 | case 4: |
| 47 | qu.display(); |
| 48 | break; |
| 49 | case 5: |
| 50 | System.out.println("Size of queue is " + qu.size()); |
| 51 | break; |
| 52 | default: |
| 53 | System.out.println("Wrong choice"); |
| 54 | } |
| 55 | System.out.println(); |
| 56 | |
| 57 | } |
| 58 | scan.close(); |
| 59 | } |
| 60 | } |
nothing calls this directly
no outgoing calls
no test coverage detected