#include "bool.h"

const int MAX_SIZE = 100;

class Stack
{
	public:

		/////////////////////////////////////////////////////////////////////////
		// Constructor (default)
		//
		//   Creates a stack of size MAX_SIZE and initializes private data
		//           
		//   Inputs: None.
		//
		//  Outputs: None.
		//
		Stack(void);


		/////////////////////////////////////////////////////////////////////////
		// Constructor 
		//
		//   Creates a stack of size 'initial_size' and initializes private data.
		//   If the 'initial_size' is < 0, then the size of the stack is set to
		//   0. If 'initial_size' is > MAX_SIZE then the size of the stack is
		//   set to MAX_SIZE.
		//           
		//   Inputs: initial-size - an integer that specifies the size of the
		//                          stack
		//
		//  Outputs: None.
		//
		Stack(int initial_size);		

		/////////////////////////////////////////////////////////////////////////
		// Function: pushItem 
		//
		//   Adds an item to the stack. Verifies the stack is not full before 
		//  adding the item. Changes the stack.
		//           
		//   Inputs: item - an integer that is added to the statck
		//
		//  Outputs: None.
		//
		void pushItem(int item);

		/////////////////////////////////////////////////////////////////////////
		// Function: popItem 
		//
		//   Removes the item that is at the top of the stack. Verifies the 
		//   stack is not empty before removing the item. Changes the stack.
		//           
		//   Inputs: None.
		//
		//  Outputs: Returns the integer at the top of the stack
		//
		int popItem(void);

		
		/////////////////////////////////////////////////////////////////////////
		// Function: peekAtTop 
		//
		//   Returns the integer that is at the top of the stack without 
		//   removing it.
		//           
		//   Inputs: None.
		//
		//  Outputs: Returns the integer at the top of the stack
		//
		int peekAtTop(void) const;


		/////////////////////////////////////////////////////////////////////////
		// Function: isEmpty
		//
		//   Checks if the stack is empty
		//
		//   Inputs: None.
		//
		//  Outputs: Returns TRUE if the stack is empty, otherwise, FALSE
		//
		Boolean isEmpty(void) const;


		/////////////////////////////////////////////////////////////////////////
		// Function: isFull
		//
		//   Checks if the stack is full
		//
		//   Inputs: None.
		//
		//  Outputs: Returns TRUE if the stack is full, otherwise, FALSE
		//
		Boolean isFull(void) const;


		/////////////////////////////////////////////////////////////////////////
		// Function: display
		//
		//   Prints out the contents of the stack to the screen
		//
		//   Inputs: None.
		//
		//  Outputs: Displays the stack's contents on the screen
		//
		void display(void) const;

		/////////////////////////////////////////////////////////////////////////
		// Function: getCount
		//
		//   Returns the number of items on the stack
		//
		//   Inputs: None.
		//
		//  Outputs: The number of items on the stack
		//
		int getCount(void) const;


		/////////////////////////////////////////////////////////////////////////
		// Function: getSize
		//
		//   Returns the size of the stack
		//
		//   Inputs: None.
		//
		//  Outputs: The size of the stack
		//
		int getSize(void) const;

	private:

		int items[MAX_SIZE];   // the array that represents the physical stack
		int top;               // the index of the top of the stack
		int size;              // the logical size of the stack

};
