Assignment LinkedStack<E> implements OurStack<E>
Due: Friday, 21-Oct by 9:00 pm via web cat turnin. WebCat will not accept any submissions after 9:00 pm Friday. If not done by this time, you get 0 points! Note: The three files for this assignment are required for the MineSweepr Project. Begin this immediately!
Collaboration: Solo. Work on this alone with help from Piazza, SLs, and/or Rick
You are asked to implement the Stack abstract data type with following goals:
· Understand the different behavior of insertions and deletions in Stacks
· Use Node objects again as a way to store data where nodes are linked by one of its instance variables
· This will help when we implement other linked structure and the binary tree data structure
· Gain further practice with linked structures, exceptions, interfaces, generics, and unit testing.
1) Begin a new Eclipse project, write an @Test method to LinkedStackText.java, hover over @Test and select Add JUnit4 to the build path (Recommended), or do the following when you create your new project:
· Select File > New > Java Project
· Enter Project name: LinkedStack
· Click the Next button at the bottom
· Select the Libraries tab at the top
· Click the Add Library button on the right
· Select JUnit
· Click Next button
· Select JUnit 4 (not 3)
· Click the Finish button
2) obtain this interface that represents an important abstract data type (Stack):
interface OurStack<E> in OurStack.java
3) Create a new public class LinkedStack<E> implements OurStack<E> and add all the required methods as stubs (let Eclipse do this for you).
4) Write a unit test for LinkedStack<E> implements OurStack<E> and use a singly linked structure to implement the LinkedStack<E> collection class. Use one external reference named top (or first if you prefer). The collection class must be named LinkedStack. Ensure E pop() and E peek() are throwing exceptions whenever the stack is empty (Rick's test will). Here is one for pop():
@Test(expected = EmptyStackException.class)
public void testPopOnEmpty() {
OurStack<String> s = new LinkedStack<String>();
String top = s.pop();
}
5) Turnin your completed Eclipse project to WebCat by Firday 9:00 pm: LinkedStack
Grading Criteria 30pts max, subject to change
___/ 30 For 100% code coverage and problem coverage on WebCat only if turned in before the deadline
You can get a score of 0% even though all of your tests passed in your workspace for the following reasons:
1. WebCat reports a compile time error such as Unknown symbol
2. One of Rick's test cases placed one of your loops into an infinite loop for a Timeout Error
3. One of your assertions failed on WebCat (even though it passed for you locally)
4. You did not submit a unit test, so you receive 0% code coverage (0 * 100 is 0pts)
5. You did not use a singly linked structure of Node objects as you data structure