list :: problem set

Use the List Tester Class (next link) to answer these questions. Answer these questions using methods.
  1. Rewrite the method printList() so that, as well as printing the values in the list, it also prints a message if the list is empty
  2. Write an instance method sum() for the List{} class that returns the sum of the values in the info fields
  3. Write 2 instance methods: deleteFirst() and deleteLast(), the first method is used to delete the first node in the list and the second to delete the last node. If the list is empty, both methods are to print a warning message
  4. Write the method addAtRear() for the List{} class. This method should have a single int parameter called item. The method should first locate the last node in the list, and then create and attach a new node containing the value of item at the end of the list
  5. Write an instance method called contains for the List class. The method should have the header: public boolean contains (int item). The method should return true if and only if its implicit List object contains item
  6. Write an intance method deleteAll for the List class. The method should have one int parameter: item. It should delete all nodes that contain item in their info field
Check answers here