CSCE 2014 - Homework 3
Due Date - 10/13/2009 at 11:59 PM

1. Problem Statement:

The purpose of this programming assignment is to create a program that can tabulate the ballots for the Heisman Trophy and determine the winner. The Heisman ballots contain a 3-2-1 point system, in which each ballot ranks the voter's top three players and awards them three points for a first-place vote, two points for a second-place vote, and one point for a third-place vote. The points are tabulated, and the player with the highest total of points across all ballots wins the Heisman Trophy.

To simplify the problem, we will assume that all of the ballots are stored in an unsorted ascii file of the form:

   place first-name last-name
   place first-name last-name
   place first-name last-name

The place values will be integers between 1 and 3. The player's name will be stored in two strings first-name last-name. If someone has a multiple part name, like "Jean Claude Van Damme" this will appear in the file as "Jean-Claude Van-Damme", so you only need to read two strings per line when you process the file.

Your task is to read this file and store vote information in a Linked list with one node per player. As you read the ascii file, you will need to look up each player based on their name. If the player is not found in the linked list, you must create a new node for them. If the player is found, you need to increment their vote count.

Once you have read and processed all of the names in the ascii file, you need to search the linked list to find the name of the player with the most votes. Your program should then print the name of the winning player and number of votes they received.

Bonus (10 points): After printing out the name and votes for the winner, process the list a second time to find the player with the second highest vote total, and the player with the third highest vote total, and print this information out.

2. Design:

As noted above, you are required to use a linked list of player nodes to tabulate votes. You should design and implement one class for player nodes, and another class for the special purpose linked list we have described above. The player node class should have data fields for the player name and number of votes, and operations to get/set these fields. The linked list class should have a head pointer, and operations to create and update the linked list and to search the linked list to select the winner. Your main program can handle the file input and use the two classes you created to do the work.

3. Implementation:

There is a sample implementation of a linked list of students in lab4 that you could use as a starting point for this project. You will need to rename the class, and modify the data fields and methods to store the player information discussed above. This can then be incrementally extended to include the create, update and search operations described above.

The file processing for this project is similar to what you developed for the first two programming projects. You can use that code (or the sample solutions posted online) as a starting point for this program. As always, it is a good idea to print out what your program reads as you process the file. For debugging, you might also want to print out messages when new player nodes are created, and when the vote counts are incremented. You can comment these print statements out when the program is working properly.

4. Testing:

Use the ascii file heisman.txt to test your program. When debugging, you may want to use just the first 5-10 lines so you draw the corresponding linked list data structures by hand and verify your program results. When that works, use the whole file to test your program to check that it operates correctly for all of the requirements listed above. Also check for the error handling capabilities of the code. Save your testing output in text files for submission on the program due date.

5. Documentation:

When you have completed your C++ program, write a short report (less than one page long) describing what the objectives were, what you did, and the status of the program. Does it work properly for all test cases? Are there any known problems? Save this report in a separate text file to be submitted electronically.

6. Project Submission:

In this class, we will be using electronic project submission to make sure that all students hand their programming projects and labs on time, and to perform automatic analysis of all programs that are submitted. When you have completed the tasks above go to the class web site to "submit" your documentation, C++ program, and testing files.

The dates on your electronic submission will be used to verify that you met the due date above. All late projects will receive reduced credit (50% off if less than 24 hours late, no credit if more than 24 hours late), so hand in your best effort on the due date.

You should also PRINT a copy of these files and hand them into your teaching assistant in your next lab. Include a title page which has your name and uaid, and attach your hand written design notes from above.