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

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!