// Name:     Bradley Shedd
// Program:  LAB#11ExtraCredit
// Date:     December 1, 2010
// Class:    Java1302
// Filename: StackTest.java
// Purpose:  This class a simple driver that exercises push, pop, isFull and isEmpty.
//           Thanks to autoboxing, we can push integers onto a stack of Objects.
// *******************************************************

public class StackTest
{
   
public static void main(String[] args)
    {
   StackADT stack =
new ArrayStack();

  
//push some stuff on the stack
   for (int i=0; i<12; i++)
       stack.push(i*2);

  
//pop and print
      while (!stack.isEmpty())
       System.out.print(stack.pop() +
" ");
   System.out.println();


  
//push a few more things
   for (int i=1; i<=12; i++)
       stack.push(i);

  
  
while (!stack.isEmpty())
       System.out.print(stack.pop() +
" ");
   System.out.println();
   System.out.println(
"Coded By: Bradley J. Shedd");
    }   
}

Homepage