COMP1200-C – Assign 08 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 assign08.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_softball.txt data file from the assign08 Announcement and save in your COMP1200/assign08 folder. If you do not have folders set up for your assignment files, this is a good time to start. assign08.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: assign08.c The 2015 Auburn softball team is having a great season. In this assignment, you will read some game result from 2015_AU_softball.txt and print and graph a summary of the data. The season is not over; you do not know how many games are in the file. The following information is in 2015_AU_softball.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 Using the fscanf function, you will store ONLY the following information into 1D integer arrays: game code, Auburn runs scored, Auburn runs allowed (Opp runs), number of innings, and attendance. 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 auRuns[], int oppRuns[], int innings[], int attend[] ); 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 integer arrays. 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 auRuns[], int oppRuns[], int innings[], int attend[], int numGames ) ; Function uses the data in the 1D 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 integer array. Instead “nest” (or use) the corresponding function as the printf argument. int getSecGames( char code[], int arrayAll[], int numGames, int arraySec[] ); Function uses the code array to find the SEC games. For each SEC game, store the runs in another 1D array. Return the number of SEC games. This function is used twice, once for the Auburn runs and once for the opponents’ runs in SEC games. int extraInnings( int innings[], int numGames, int extra[] ); Function searches the innings array 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 from an integer array. Data analysis functions are given in the lecture slides. int intMax (int x[], int n); int intMin (int x[], int n); double intMean(int x[], int n); 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
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.]
New commands: 1D integer arrays indexing function calling a function nesting functions
Revisit: casting
COMP1200c – Spring 2015– assign08 – p. 1 of 2
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.  Represent ALL given values as constants.
Sample Output: 2015 AU Softall Summary #games Min Mean Max Runs scored-all 34 2 9.1 20 Runs allowed-all 0 2.4 8 Runs scored-SEC 6 4 8.2 14 Runs allowed-SEC 0 2.7 7 Games with extra innings: 14 23