CS 1401 Assignment #12

Date Assigned: Wednesday, April 16, or Thursday, April 17, 2008.

Due Date: Wednesday, April 23, or Thursday, April 24, 2008, before the beginning of your lab section.

Objective: The main objective of this assignment is to learn to handle exceptions.

Programming assignment: The task is similar to the previous Assignments 9-11: to assist the UTEP athletics department in automating its record-keeping, especially with the statistics for the 2008 Women’s Basketball Conference USA Champion Miners team. Complete this assignment in two steps:  In Part A., read player data from an input file and create an array as before, and then add exception-handling code as described below.  In Part B., write information about eligible players to a separate output file. The format of the input data file is the same as previous labs, as follows:

·         The first line contains the first player’s name;

·         The second line contains the number of games in which the first player participated;

·         The third line contains the total number of points scored by the first player during the whole season;

·         The fourth line contains the player’s GPA;

·         The fifth line contains the second player’s name;

·         The sixth line contains the number of games in which the second player participated;

·         The seventh line contains the total number of points scored by the second player during the whole season;

·         The eighth line contains the player’s GPA;

·         and so on…

 

Part A:

Assume again that the number of players does not exceed 20.  Your program must read from the input file each type of data (player’s name, number of games in which the player participated, total number of points scored by the player, and player’s GPA) and create an array of EligibleBBP components.  The average number of points scored per game is computed by dividing the total number of points scored by the player by the number of games in which the player participated.  A player is eligible to play if she has a GPA of 2.0 or above.  Then, add code to handle error conditions: If the input file is empty or if an individual player did not play in any games, throw and handle appropriate exceptions, and inform the user about the problem.

 

Part B:

After completing Part A., modify your program so that it writes to an output file named “eligiblePlayers.txt” the name, average number of points scored per game, and GPA for only the eligible players who played in at least one game.

Homework assignment: on a separate sheet of paper, solve Ex. 4 and 6 at the end of Chapter 12 (on pp. 799 and 800).

Deliverables: as instructed by your TA.