| 55 | public class STACK |
| 56 | { |
| 57 | public static void main(String[] args) |
| 58 | { |
| 59 | Scanner sc = new Scanner(System.in); |
| 60 | int s; |
| 61 | System.out.print("Enter size of stack : "); |
| 62 | s = sc.nextInt(); |
| 63 | STACK_IMPLEMENTATION s1 =new STACK_IMPLEMENTATION(s); |
| 64 | System.out.println("PRESS !!!\n1 : PUSH\n2 : POP "); |
| 65 | System.out.print("Enter Choice : "); |
| 66 | int choice =sc.nextInt(); |
| 67 | int value; |
| 68 | while(choice==1||choice==2) |
| 69 | { |
| 70 | if(choice==1) |
| 71 | { |
| 72 | System.out.print("Enter Element to push : "); |
| 73 | value=sc.nextInt(); |
| 74 | s1.PUSH(value); |
| 75 | } |
| 76 | else if(choice==2) |
| 77 | { |
| 78 | s1.POP(); |
| 79 | } |
| 80 | else if(choice==3) |
| 81 | { |
| 82 | System.exit(0); |
| 83 | } |
| 84 | s1.SHOW(); |
| 85 | System.out.println("PRESS !!!\n1 : PUSH\n2 : POP\n3 : EXIT"); |
| 86 | System.out.print("Enter Choice : "); |
| 87 | choice=sc.nextInt(); |
| 88 | } |
| 89 | } |
| 90 | } |