Homework 2 - Linked Lists

Due: Wednesday April 14, 2010 at 5:00pm

The purpose of this assignment is to create a linked list using template classes. This will be accomplished by creating a ListNode and a LinkedList class. The file hw2_list.cpp contains the "header" information for both the ListNode and LinkedList class.

Your task for this assignment is to code the bodies of the functions for both classes. We will discuss what each function is supposed to do in class. You may add additional helper functions to the private section of the provided classes, but do not add additional public functions.

ListNode class

You will define the member functions to do the following:

LinkedList class

You will define the member functions to do the following:

Menu Program

The menu program will test your implementation of the linked list. In main, you will define a linked list that stores characters. You will then operate on that list according to the following menu:
      Welcome to the Linked List Menu
  =======================================
  1.  Add a character to the list
  2.  Search for a character in the list
  3.  Delete a character from the list
  4.  Print the list
  5.  Copy the list and print the copy

  0.  Exit
  =======================================
The delete and print options (options 3 and 4) should first check if the list is empty. If the list is empty, it should print that the list is empty.

The copy option should create a copy of an empty list, but will also print that the copied list is empty if the source list is empty.

Submit your completed code as an attachment in an email.