MCPcopy Create free account
hub / github.com/SR-Sunny-Raj/Hacktoberfest2021-DSA / main

Method main

11. Stack/MenuDrivenStack.java:57–89  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

55public 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}

Callers

nothing calls this directly

Calls 4

PUSHMethod · 0.95
POPMethod · 0.95
SHOWMethod · 0.95
printMethod · 0.45

Tested by

no test coverage detected