Question: Implement stack as specified below: public class NumStack{ private int[] data; private int index; public NumStack(int cap){ if(cap <1 || cap>100) cap=50; data= new int[cap];
Implement stack as specified below:
public class NumStack{
private int[] data;
private int index;
public NumStack(int cap){
if(cap<1 || cap>100) cap=50;
data= new int[cap];
index =0;
}
public int size(){
}
public void push(int num){}
public void pop(){}
public int top(){}
public boolean isEmpty(){}
public boolean isFull(){}
}
Once completed, design a driver program to test your implementations of these methods.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
