All of the work in this project is my own!  I have not left copies of my code in public folders on university computers. I have not given any of this project to others. I will not give any portion of this project to others taking this class. I realize that the penalty for turning in work that is not my own can range from an "F" in the class to dismissal from Trinity University. 

                                    Print Name  __________________________    Time Required = ______.____ Hrs.

                                    Signature   __________________________ (pledged)


Stack2 Lab
Individual Assignment
10 Points


1]  Use the Eclipse on your computer or use one of the classroom systems.

Save a copy of Stack.java; call it Stack2.java.

2] Include the following methods:

public Stack()
public Stack(int newMax)    
                public boolean Empty()
public boolean Full()
public boolean Push (long newInfo)
public void Display(String message)
public void DisplayAll()
public void Display()
                public int StackTop();
                public boolean Resize(int changeAmount)

3] Function StackTop shall explicitly return the information contained in the top of the stack.
4] Function Resize shall alter the size of the stack by the changeAmount. You can do better than the one we did in class. Extra Credit available.
5] Include the following in your program:
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// TestStack //////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
	
	/**
	*  Test the Stack Functions
	*/	
	public static void TestStack() 
	{
		StackA Stack1 = new StackA();
		StackA Stack2 = new StackA(4);
		
		Stack1.DisplayAll("Stack1");
		for (int Counter = 1; Counter <= 8; Counter ++)
		{
			if (Stack2.Push(Counter * 10))
				Stack2.Display("Stack2");
			else
				System.out.println("Stack Overflow Attempt");
		}
		for (int Counter = 1; Counter <= 8; Counter ++)
		{
			if (Stack2.Pop())	
			{
				Stack2.Display("Stack2");
				System.out.println("oldInfo = " + Stack2.PopValue());
			}
			else
				System.out.println("Stack Overflow Attempt");
		}
		
		StackA s1= new StackA(3);
		for (int counter = 1; counter<=500; counter++)
		{
			if (s1.Push(counter * 5)){ }
			else
			{
				System.out.println("Overflow attempted");
			}
		}
		s1.Display("s1");

		
		StackA s2= new StackA(3);
		for (int counter = 1; counter<=500; counter++)
		{
			if (s2.Push(counter * 5)){ }
			else
			{
				System.out.println("Overflow attempted");
			}
		}
		s2.Display("s1");
	}
	
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// Main ///////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

	public static void main(String[] args) 
	{
		TestStack();

	}
 
6] Discuss in English, all of the steps that you did in the Resize method. 

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  
7] Why did the Resize method make your Stack class more robust? Discuss!

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  
8] In the space below, tell what a Java Package is and why would use it. Review your book and use at least one internet reference.
Internet reference = http://_________________________________________________________________________


_________________________________________________________________________________________________  

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  
9] In the space below, tell what a Java Interface is and why would use it. Review your book and use at least one internet reference.
Internet reference = http://_________________________________________________________________________


_________________________________________________________________________________________________  

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  
10] In the space below, tell what a Java Virtual Function is and why would use it. Review your book and use at least one internet reference.
Internet reference = http://_________________________________________________________________________


_________________________________________________________________________________________________  

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  

_________________________________________________________________________________________________  
11] Read through the following:
http://www.faqs.org/docs/think_java/TIJ307.htm
 

What To Turn In

1] Printed copy of this assignment sheet signed. Answer the questions!

2] Printed copy of code. Mail me an electronic copy!  The Subject must be STACK2

3] One Paragraph Story - Tell me anything you want to tell me - how you are doing, a joke, a favorite story,
what is happening in your life, etc.