CSCE 2014 - Homework 2
Part 1 Due - 02/08/2013 at 11:59 PM
Part 2 Due - 02/15/2013 at 11:59 PM

1. Problem Statement:

The goal of this homework assignment is to give students more experience with linked lists and file input/output. Your first task is to read an ASCII file containing NFL football statistics and store this information in an unsorted linked list class. Your second task is to implement methods to search this linked list to print out selected information. The assigment is broken into two parts, which are described in more detail below.

2. Design:

Part 1: Your first task is to write a function to open and read the ASCII file QB.txt to extract quarterback statistics. This file contains 16 pieces of information about each quarterback (PlayerName Position Team Games Attempts Attempts/Game Completions Completion% Yards Yards/Game Long Touchdowns Interceptions Sacks SackYardsLost Rating). Your function should read ALL of these fields into variables of the correct data type (string, int, float) and print them to the screen. When you have this part done, you can upload your source code and an empty documentation file and then continue with part 2 of the assignment.

Part 2: You next task is to design the "quarterback_node" and "quarterback_list" classes. Select any 5 of the quarterback statistics above to store in your quarterback_node, and define corresponding methods to set/get/print these fields. Once you have the quarterback_node class debugged, you need to create a quarterback_list class with the following operations:

  • Insert - add a QB record to the linked list.
  • PrintAll - print all QB records in the links list.
  • PrintName - search the list and print the QB record based on name. (eg. PrintName("Tony Romo") should print this player's QB stats)
  • PrintStatistic - search the list and print QB records based on one of the player's statistics. (eg. PrintRating(90) should print all QB records where the player has a Rating > 90)
  • Clear - remove all QB records from linked list.

    When you have these classes completed, write a small main program that calls all of the methods above to demonsrate they are working correctly. Start by adding calls to "Insert" inside the code you wrote to read the QB.txt file. This will create a linked list with 51 nodes. Then add calls to your "Print" methods to demonstrate that they are working properly. Finally, call "Clear" followed by "PrintAll" to show that you are correcly removing nodes from the linked list. Save a copy of this screen output to include with your project documentation.

    Bonus: If you have ALL of the above completed and tested before the due date you might like to try adding a "SortedInsert" method (5 points) or "Delete" method (5 points) that use the algorithms described in class to insert QB records in sorted order based on PlayerName, or delete QB records based on PlayerName. To demonstrate that "SortedInsert" is working correctly, you should use a text editor to randomize the order of QBs in the QB.txt file, and then print the linked list after reading/inserting QB records into the linked list. To demonstrate "Delete" you simply need to print the linked list before/after several deletes have been performed.

    3. Implementation:

    You can implement this program using either a bottom-up approach or a top-down approach. If you go for a bottom-up approach, start by creating basic methods and classes, and test theses methods using a simple main program that calls each method. When this is working, you can create the main program that uses these methods to solve the problem above.

    If you go for a top-down approach, start by creating your main program that reads user input, and calls empty methods to pretend to solve the problem. Then add in the code for these methods one at a time. This way, you will get an idea of how the whole program will work before you dive into the details of implementing each method and class.

    Regardless of which technique you choose to use, you should develop your code incrementally adding code, compiling, debugging, a little bit at a time. This way, you always have a program that "does something" even if it is not complete.

    4. Testing:

    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. Test your program and 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.