Class StackC

java.lang.Object
  extended by StackC

public class StackC
extends java.lang.Object

Provides a Stack object for storing ints

Version:
Option C
Author:
Philip Howard

Constructor Summary
StackC()
          Creates a new, empty Stack object.
 
Method Summary
 boolean isEmpty()
          Returns whether the Stack is empty or not.
 boolean isFull()
          Returns whether the Stack is full or not.
 int pop()
          Pops the top number off the stack.
 void push(int num)
          Pushes the given number onto the stack
 
Methods inherited from class
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackC

public StackC()
Creates a new, empty Stack object. This stack can hold 4 numbers.

Method Detail

isEmpty

public boolean isEmpty()
Returns whether the Stack is empty or not.

Returns:
True if the stack is empty, false otherwise

isFull

public boolean isFull()
Returns whether the Stack is full or not. Note the stack can hold 4 items.

Returns:
True if the stack is full, false otherwise.

pop

public int pop()
Pops the top number off the stack. This removes the number from the stack and returns it.

Returns:
The number popped off the stack

push

public void push(int num)
Pushes the given number onto the stack

Parameters:
num - The numbers to be pushed onto the stack