In the lectures, we discussed a class, SLinkedList, which, from the perspective of the user, is an ordered list of string elements. In designing the code for the class, we used a linked list implementation. (In the lectures, we called this class SinglyLinkedList.)

In this assignment, you should add the correct code for three public methods of the class SLinkedList:

  1. A method public void addLast(String s), by which the user can add string s to the end of the list. (3 points)
  2. A method public void removeLast(), by which the user can remove the string that is at the end of the list. (4 points)
  3. A method public boolean contains(String s) which returns true exactly when string s is in the list. (3 points)

The SLinkedList class with the code for some of the other methods of the class can be found here, along with the Node class that it uses. Do not modify the Node class, or any existing methods and fields of the SLinkedList class. The things you are allowed to do are (a) write and modify the body of the three methods above as needed, and (b) add new fields or methods to the SLinkedList class if you need to do so.

Submit the completed source files into the dropbox folder Homework3 on ICON. The assignment is due by 11:59 pm on the 17th of September.