S-Linked Stack of Integer For this assignment you are to implement the interface named StackOfIntegerInterface. Here are
Question:
S-Linked Stack of Integer For this assignment you are to implement the interface named StackOfIntegerInterface. Here are the details:
1. Your class must be named SLinkedStackOfInteger.
2. You will need to include a separate SNode class.
3. Your SLinkedStackOfInteger class must implement StackOfIntegerInterface.
4. Your class should not have a main method. If you want to test your class, you should write a separate program.
5. Your class will throw two custom exceptions: EmptyStackException that extends RuntimeException, so you will need an additional Java file for the exception. Note, there is no exception for a full stack since the stack can keep growing.
6. Your SLinkedStackOfInteger class must have two instance variables (no more, no less): a. SNode tos b. int size
7. Your SLinkedStackOfInteger class should have only one constructor. This is a default constructor that sets tos to null and size to zero.
8. Your SLinkedStackOfInteger class must implement all of the methods specified in the StackOfIntegerInterface. See the code comments for details on what each method is supposed to do. You can also look the HTML documentation generated from the Javadoc comments. a. Pay particular attention to the toString method. The strings returned by this method must exactly match the specification (spaces included), otherwise the tester program will not recognize your program's output as correct.
9. The interface methods that your class implements must all include the @override annotation. You are being provided with a Tester program, called StackOfIntegerTester.java. If your SLinkedStackOfInteger class is working as it should, the tester will print a message indicating all tests have passed, otherwise it will display an error message.
/** * Returns a string showing the contents of this stack and indicating * that the top-of-stack is on the left. The individual stack items are * surrounded by square brackets and are separated by a comma and a space. * Here are some examples: * An empty stack TOS [] * After pushing 1 TOS [1] * After pushing 2 TOS [2, 1] * After pushing 3 TOS [3, 2, 1] * After popping TOS [2, 1] * After popping TOS [1] * After popping TOS [] * @return A string representation of this stack