BASKETBALL TEAM STATISTICS
OVERVIEW
The Daring Dunkers basketball team is computerizing its records. You are to write a program that computes field goal and free throw percentages for the players. The players on the team are identified by their first name. Their game statistics are stored in a text file. You are to read the text file, perform computations, and print a report summarizing their peformance. Also compute and display the team averages.INPUT REQUIREMENTS
The input is read from a data file named "bbstats.dat". Each line of the file represents statistics recorded for a player during one basketball game. The line contains the player's first name and four integers: the number of field goals attempted, field goals made, free throws attempted, and free throws made. For example,
are statistics for player Hank which show 9 attempted field goals, making 5 of them, and 4 free throws attempted out of which 3 scored.
Statistics for several games may be included in the text file, so there may be more than one record in the file for each player. It is not known in advance how many records are in the file.OUTPUT REQUIREMENTS
1. Title and column headings.
2. A report which lists for each player:
4. Invalid data message: "Invalid data in line X."
5. File open error message: "Can't open input file." The application should then terminate.
6. Given this data file, the report should be formatted as shown here:1. Open the data file and verify success.
2. Read the data from the file and accumulate the player data.
3. Perform validity checking on the input data: Verify that each number is an integer between 0 and 100 (inclusive), and that shots made is not more than attempted. If the data is invalid, display an error message which gives the line number in the file (see above), and skip processing the player's record, but continue reading the rest of the file.
4. For each player, the program is to compute:
Total points = Field goals made * 2 + free throws madeField goal percent = field goals made / attempted
Free throw percent = free throw made / attempted
5. For the entire team, compute:
Team Average field goal percent = Total field goals made / Total field goals attempted.Team Average free throw percent = Total free throws made / Total free throws attempted.
6. Print the player summary report with names in
the
order they appear in the data file and the team averages.
ASSUMPTIONS
1. Each player has a unique first name (no two player's share the same name). The name has no embedded blanks and has a maximum length of 15 characters.
2. The data in the file is complete, that is, there are no missing data items for a player.
3. The numeric data is integers (not float or
character).
4. There will be at most 1000 unique
players
in the data file.
DISCUSSION
We will utilize an array of records to accumulate
the
individual player totals for each statistics: GoalsTried,
GoalsMade,
ThrowsTried,
ThrowsMade.
The logic is straightforward: read and accumulate all the data from the file, then process the array from start to finish, performing computations as you go. Print out team averages at the end. One possible error condition we need to check for, is that a player may have no shots attempted, in which case the percent computation would get a divide by zero error. We need to include code to prevent this from happening and display zero percent. (Although unlikely, it's possible that the entire team was shutout, so we need a similar check in the team average computations).
Your design must decompose the solution into five subprograms (procedures or functions): Do not use global variables. You must
pass all needed data to subprograms via parameters.
You need to submit your source code electronically using the
handin utility: No
late submittals will be accepted!
handin graderjd Project6 bbstats.c (optional other files)