52 lines
813 B
Java
52 lines
813 B
Java
/**
|
|
* A stack of strings.
|
|
*
|
|
* @author Marcus
|
|
*/
|
|
public class Stack {
|
|
|
|
/**
|
|
* Creates a new empty stack.
|
|
*/
|
|
public Stack() {
|
|
super();
|
|
}
|
|
|
|
/**
|
|
* Adds the specified string on top
|
|
* of the stack.
|
|
*
|
|
* @param string The string to add.
|
|
*/
|
|
public void addToTop(String string) {
|
|
// TODO: implement
|
|
}
|
|
|
|
/**
|
|
* Removes and returns the string on
|
|
* top of the stack or null, if the
|
|
* stack is empty.
|
|
*
|
|
* @return The last item that has been
|
|
* pushed onto the stack or null, if
|
|
* the stack is empty.
|
|
*/
|
|
public String removeFromTop() {
|
|
// TODO: implement
|
|
return "ABCDEFG";
|
|
}
|
|
|
|
/**
|
|
* Returns the current number of
|
|
* strings on the stack.
|
|
*
|
|
* @return The current number of strings
|
|
* on the stack.
|
|
*/
|
|
public int size() {
|
|
// TODO: implement
|
|
return -1;
|
|
}
|
|
|
|
}
|