CS 153 – Data Structures I

Homework Assignment #4

Instructions:

This assignment is due on Thursday, February 15, 2007.

Description

Our customer, Mr. Ed Wood, is starting up a mail-order DVD movie rental business. He needs us to develop custom software that will allow him to keep track of all the DVDs in his collection. For now he just needs to be able to store thetitle, length (in minutes), and year made for each DVD movie. In addition to storing this information, he also needs to be able to search for a movie by the combination of those fields.

LINKED_LIST Class

The data structure we will be using to store the collection is a pointer-based singly-linked list. The linked list class should be templated, and should have the following functionality:

  • Constructor
  • Copy Constructor
  • Destructor
  • Insert Head
  • Insert Tail
  • Remove - Remove all occurrences of a specified item from the list
  • Clear - Clear the contents of the list
NODE Class

The node data structure used in conjunction with the LINKED_LIST class should also be a templatedclass.

MOVIE Class

You will need to define a variable in your dialog class of type LINKED_LIST (or whatever you name your linked list class). This variable declaration should specify that this list will contain items of type MOVIE. You must write the MOVIE class to store the title, length[1], and year[2] for a movie. This class should be complete with appropriate accessors, mutators, and comparison operators for this application. The MOVIEclass itself will not be templated.

Graphical User Interface

The Graphical User Interface (GUI) for this program should be implemented using a Visual C++ Dialog. The GUI will need to have the following capabilities:

  • Data Entry: The user should be able to enter the title, length, and year of a movie, and have it added to the linked list. Empty fields are not acceptable (i.e., you should generate a MessageBox error message if that occurs on an ‘add’, ‘remove’, or ‘find’ operation). In addition, the user must have the ability to specify whether the new data goes onto the head or the tail of the list. Duplicate entries are allowed.
  • Data Display: The GUI should show the contents of the linked list. The order of the data displayed must match exactly with the actual contents of the list. (Hint: If you use a list box, turn off the sort feature.)
  • Data Removal: The user should be able to remove alloccurrences of a specific item from the collection. An information box in the dialog should indicate how many occurrences were actually removed (see User Feedback below).
  • Data Find: The user should be able to search for a specific movie based on title + length + year. A search should result in the display of the number ofitems found in the collection that have the specified title, length, and year.
  • User Feedback: A portion of the GUI should be dedicated to providing the user with information regarding the success or failure of the various operations the program is performing. (No message boxes should be used for this kind of display.)
Other Notes
  • Remember that this program has to meet departmental programming guidelines and requirements specific to this class.
  • Note that the programming standards address the issue of function naming. Functions should be named such that the function name is an accurate reflection of what the function does. This rule also applies to event-handler functions for your dialog. An appropriate button function name (for an Insert button) is OnInsertButtonClicked, whereas an inappropriate name for this function is OnButton1Clicked.
  • The only Standard Template Library (STL) class allowed is the string class. Remember, one of the major ideas of this class is for the student to learn about data structures by writing them, not just using them.
  • The LINKED_LIST class and the MOVIE class should not use any Microsoft Foundation Classes (MFC), or anything GUI-related. The only exception to this is the CString class, which is allowed.

Extra Credit

You can earn 5 pts. extra credit on this project by doing the following. Overload the assignment operator = for the LINKED_LIST class, and include appropriate functionality in your dialog to demonstrate to the graders that your assignment operator works properly.

You can also earn 5 pts. extra credit on this project by making your application do “wildcard” searches on any combination of title, year, and length. For example, allow the user to specify just the length of a movie, and you find all movies that have that length. Or, let the user specify the length and year, and you find all movies that match those criteria, and so forth.

[1] The valid range for length is an integer from 1-600 minutes (inclusive).

[2] The valid range for year is an integer from 1940 – 2007 (inclusive).