Question: As instructed, Please modify the program (Add a new method) to the existing program import java.util. % / Function to check if stack is empty

As instructed, Please modify the program (Add a new method) to the existing program
 As instructed, Please modify the program (Add a new method) to
the existing program import java.util. % / Function to check if stack
is empty */ public boolcan isEmpty() i return lop=1; / Function to
check if stack is full / public boolean isFull() \{ returntop=size1; /

import java.util. % / Function to check if stack is empty */ public boolcan isEmpty() i return lop=1; / Function to check if stack is full / public boolean isFull() \{ returntop=size1; / Function to get the size of the stack #/ public int getSize() return len: /* Function to check the top element of the stack / public int peek() \{ if (isEmpty()) throw new NoSuchElementException("Underflow Exception"); return arr[top]: / * Function to add an element to the stack */ public void push(int i) i default : System.out.println("Wrong Entry "); break; \begin{tabular}{l} /* display stack / \\ stk.display(); \\ System.out.println(" Do you want to continue (Type y or n) "); \\ ch = scan.next(),charAt (0); \\ ; while (ch== ' Ych==y); \\ \hline \end{tabular}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!