Due: , 11:59 pm
The goal of this lab period is to give you an opportunity to implement a stack.
public IntStack( )a constructor that makes an array of 10 ints and initializes the top index to be 0.
public void push( int new_item )pushes a new item onto the stack. If there isn't enough room in the array, then create a new array and copy the data over. The size of the new array is equal to twice the size of the old array.
public int pop()pops an item off the stack and returns it.
public int elementAt( int index )returns the element at the given position (do not modify the stack).
public int size()returns the number of items in the stack.
public boolean isEmpty()returns true if the stack is empty.
When you are done with the lab exercises, you may start on the rest of the project.
© 2017 Caitrin Eaton.