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)
Stack Lab
Individual Assignment
25 Points
1] Use the Eclipse on your computer or use one of the classroom systems.
Create program Stack.java.
2] The Stack private data used in class:
private long [] info;
private int top;
3] 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)
{
System.out.println(message);
Display();
}
public void DisplayAll()
{
int Pos;
System.out.println(" |-----------------|") ;
for (Pos = info.length - 1; Pos >= 0 ; Pos -- )
{
System.out.printf("%5d | %15d |\n", Pos, info[Pos]);
System.out.println(" |-----------------|") ;
}
System.out.println("top = " + top + " Max = " + (info.length-1) + "\n");
}
public void Display()
{
int Pos;
if (Empty())
System.out.println("This Stack Is Empty!") ;
else
{
System.out.println(" |-----------------|") ;
for (Pos = top; Pos >= 0 ; Pos -- )
{
System.out.printf("%5d | %15d |\n", Pos, info[Pos]);
System.out.println(" |-----------------|") ;
}
}
System.out.println("top = " + top + " Max = " + (info.length-1)+ "\n");
}
4] We did the functions above together in class. None of you objected when I tried to do the following in lecture:
public boolean Pop (long oldInfo)
5] We did this in class and had problems getting the top info into the oldInfo container. I could tell from the lack of discussion that you have not fully understood all of the things from chapter 2. None of you could explain why OldInfo had not changed; I assigned you to figure out why; I suggested you do an Internet search with key words "java passing by reference"
6] Do the Internet search. In the space below, summarize what you found out. There are many wrong things out there; examine more than one source. _________________________________________________________________________________________________
_________________________________________________________________________________________________
_________________________________________________________________________________________________
_________________________________________________________________________________________________
_________________________________________________________________________________________________
_________________________________________________________________________________________________
7] What is a java Numeric Wrapper? Explain
_________________________________________________________________________________________________
_________________________________________________________________________________________________
_________________________________________________________________________________________________
8] Write the code to create an object, called age, of type Integer, not int, and fill it with 27. Write the code to display the contents of age. Write the code to increment object age. Write the code to display the contents of age. Test it.
_________________________________________________________________________________________________
_________________________________________________________________________________________________
_________________________________________________________________________________________________
9] From what you have said above, you will have to change your stack class in some way to store the return value. You are welcome to alter the stack class in any way you choose.
10] If by this point, you are still confused about passing by reference, search the Internet for Java, Swap, Reference
11] Read the following:
http://www.yoda.arachsys.com/java/passing.html
1] Write a main program which
2] Print the program
code
3] Mail me a copy of Code before class on Tuesday - Subject shall be CSCI-Stack
4] Make sure you have at least two additional
backup copies of all projects. Maybe store a copy of your workspace on your Y drive and one on your
hard drive.
1] Examine the Utilities.java file given to you in class. Use your notes. I did this in class with you.
2] Print javadoc created html program that goes with your Stack
1] Printed copy of this assignment sheet signed.
2] Printed copy of code. Mail me an electronic copy!
3] Printed copy of the javadoc file.
4] 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.