Question: Using C++ Visual 2015 or 2017, create a program for the following: A college baseball team is rated number one in the state and the
Using C++ Visual 2015 or 2017, create a program for the following: A college baseball team is rated number one in the state and the coach would like to keep it that way. After discovering that you know how to program, the coach has asked that you write a program to generate some important statistics about the players. With this information, the coach hopes to spot and improve any of the player's weak areas and thus keep the team's top ranking. The coach stored all the player information in an input file named BaseballStats.txt containing the following data: Player Jersey Num: 10, 2, 34, 63, 12, 14, 27,8, 42, 33
At Bats: 36, 12, 18, 41, 10, 2, 55, 27, 32, 19
Hits: 25, 5, 7, 20, 3, 1, 27, 12, 8 4
Runs: 2, 0, 1, 4, 1, 1, 10, 3, 2, 1
RBIs: 5, 1, 0, 2, 0, 1, 8, 4, 1, 0
Requirements: 1. Use input file BaseballStats.txt 2. Store all input data in the following parallel arrays: a. Int playerNum[SIZE], b. atBats[SIZE], c. hits[SIZE], d. runs[SIZE], e. rbis[SIZE], f. batAvg[SIZE]; g. where size is a defined constant with a value of 20. 3. Create the following functions a. void loadArrays (int[], int[], int[], int[], int[], int[], int &); Reads the input data into the arrays. You do not know how many lines of input there will be, so you will need an EOF loop, and you will need to keep a count of the number of players stored. b. void calcBatAvg (int[], int[], int[], int); Calculates each player's batting average storing the results in the batAvg array. Batting average is computed by dividing hits by at bats. This will result in a percent, multiply the result by 1000 and round to the nearest integer to get the integer batting average. c. void printStats(int[], int[], int[], int[], int[], int[], int); Print a neatly formatted table with headings and one output line for each player containing player number, at bats, hits, runs RBIs, batting average and a comment about the player. Use the following scale to determine the comment: Bat AvgComment 500?1000 WORLD SERIES 300?499 FARM LEAGUE 0?299 LITTLE LEAGUE 4. Use functions as you see fit to: a. Calculate and output the total at bats, hits, runs, and rbis, and the team's batting average. Figure the team's batting average by dividing the total hits by the total at bats then multiplying by 1000 and rounding as previously described. b. Output the best and worst values (and which player achieved them) for batting average, hits, and runs. 5. Functions must pass parameters and return values as needed, using local variables and not accessing global variables..
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
