COMP1200-C – Assign 09 solution

$24.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (1 vote)

Submit assign09.c via Canvas
Before you start writing your program: Read these instructions carefully. A development plan is a process that guides you through solving a problem and creating an algorithm. Download the 2015_AU_softball09.txt data file from the assign09 Announcement and save in your COMP1200/assign09 folder. If you do not have folders set up for your assignment files, this is a good time to start. assign09.m will look in the folder where it is saved for the data file. A development plan is a process that guides you through solving a problem and creating an algorithm. Create your own algorithm and use it as comments throughout your program. Use section comments to group your statements as well as comments from your algorithm.
Problem: Program: assign09.c The 2015 Auburn softball team is having a great season. In this assignment, you will read some game result from 2015_AU_softball09.txt and print a report shown below. The season is not over; you do not know how many games are in the file. The following information is in 2015_AU_softball09.txt for each game of the season: Game AU Opp no. Attend Game length Code r-h-e* r-h-e* innings hr : min x 15-13-1 5-5-1 5 845 2:15 @ 11-13-1 2-5-0 5 967 1:44 *r-h-e = runs-hits-errors
In assign09.c, you will re-write assign08.c using a 2D array for the save integer values and a double 1D array for the game time. Using the fscanf function, you will store ONLY the following information into 1D and 2D arrays: • game code into a 1D char array; • Auburn runs scored, Auburn runs allowed (Opp runs), number of innings, and attendance into a 2D int array; • use hour and minutes to compute the game length and save into a 1D double array. All other values are “skipped” using “hold” variables. See the skipData.c example on Canvas. The printed summary should contain the number of games, minimum, mean, and maximum runs scored and allowed for all games and for SEC games. The game code for SEC games is an asterisk, *.
Use the following user-defined functions to perform the described tasks. The program structure diagram provides a guide to the relationship of the functions and the information passed to and from the functions. // FUNCTION PROTOTYPES====================================================== int getFileData ( char code[], int gameStats[][NUMCOLS], double hours[] ); Function opens and read the data file. Because code, a char, is the first for each game, put a blank at the beginning of the formatting, i.e. “ %c %d%c…” If there is an open error, print a message and return to main. Read all data and save specified data in 1D and 2D arrays as described above. Return the number of games read. If there is a file open error, the returned number of games counter will be zero. Use this information in main to determine if the program should be continued. If no games were read, print a message and do not continue the program. void printSummary( char code[], int gameStats[][NUMCOLS], double hours[], int numGames ); Function uses the data in the arrays and the number of games to print a summary report. Do not use a variable name for the minimum, mean, and maximum value of an array. Instead “nest” (or use) the corresponding function as the printf argument. int getSecGames ( char code[], int arrayAll[][NUMCOLS], int numGames, int arraySec[][NUMCOLS] ); Function uses the code array to find the SEC games. For each SEC game, store the game information in another 2D array. Return the number of SEC games. This function is used only used once because the 2D array has Auburn and opponents runs in SEC games. int extraInnings( int gameStats[][NUMCOLS], int numGames, int extra[] ); Function searches the inning column for values greater than the number of innings. The game number of each game with extra innings is stored in another 1D array. Return the number of games with extra innings. Create data analysis functions to return the minimum, mean, and maximum value of a column of a 2D integer array. Data analysis functions are given in the lecture slides. Note the addition of the column number parameter. int intColMax ( int x[][NUMCOLS], int n, int colNum ); int intColMin ( int x[][NUMCOLS], int n, int colNum ); double intColMean( int x[][NUMCOLS], int n, int colNum ); Also, create a function to find and return the maximum value in a 1D double array.
Read all instructions before beginning your work.
NOTE: Your submitted file(s) MUST be spelled and cased as instructed. [-5 points for not doing so.]
COMP1200c – Spring 2015– assign09 – p. 1 of 3
Problem Constants: FILENAME “2015_AU_softball.txt” MAXGAMES 50 // estimated number of games in season NUMSEC 25 // estimated number of SEC games in season SECDODE ‘*’ // code for SEC games NUMINNINGS 7 // number of innings in a game NUMCOLS 4 // number of columns in game info array AU_COL 0 // Auburn runs in 1st column of game info array OPP_COL 1 // Opp runs in 2nd column of game info array INN_COL 2 // no. of innings in 3rd column of game info array ATT_COL 3 // attendance in 4th column of game info array MIN_IN_HOUR 60 // number of minutes in an hour Problem Inputs: See above. Problem Outputs: See above. Other variables: As needed. Instructions:  See Standards for Documentation of C Programs on the Resources page on Canvas.  Insert comments at the top and throughout each file. o Include the follow comments at the beginning of this (and ALL) files. // submitter’s name, GROUP # Grade of ZERO for files with submitter name not part of Canvas group // other group members’ names Type “none” if submitting alone. // assignment number Zero points for comments if no collaboration statement // date you completed the assignment // statement(s) about collaboration // a short narrative about what the file does o Use the algorithm given as comments throughout your program.  Use descriptive variable names.  Use Sample Input/Output as a guide.  Use Generate CSD to ensure correct indenting.  Using constants defined at the top of your program allows flexibility when information is changed in the future. o Represent ALL given values as constants. o Other than zero and optional one for counting initialization, use constant names NOT numbers throughout your program.
Sample Output: 2015 AU Softall Summary #games Min Mean Max Runs scored-all 41 2 8.9 20 Runs allowed-all 0 3.0 10 Runs scored-SEC 11 4 8.1 14 Runs allowed-SEC 0 4.1 8 Games with extra innings: 23 38 Longest game played: 3.25 hours