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