Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is a Baseball Player Statistics program where you will be storing actual data of baseball players using structures and doing operations on them. The
This is a Baseball Player Statistics program where you will be storing actual data of baseball players using structures and doing operations on them. The file baseballdata.txt has the data of 11 baseball players and multiple attributes related to their statistics. The schema of the data file is reflected in the file baseballdatadescription.txt : which describes what are the statistics in the data file of the player, and it holds the same for all the players. You will start by creating 3 different structures : a) offense: houses the offensive statistics of the players (Hits, HomeRuns, BattingAverage, Runs, RBI, stolen base, OBP. Slugging. OPS, Silver Slugger Years) b) defense: houses the defensive statistics of the players (Putouts, Assists, Errors, Fielding%, Golden Glove Years) c) players which nests the offense and defense structures and stores other extra metadata of the players(Name, Position, Bats, Height, Weight. DraftedBy, Halloffame. AllStarGames) You need to parse the baseballdata.txt file and create an array of players, with all of their statistics loaded from the incoming file. The statistics include various types of primitive data elements such as float, integer, strings, booleans, and arrays. You should be able to determine the appropriate type for appropriate statistics by observing the file. Take the reference of baseballdatadescription.txt and make sure that your players have all of the statistics loaded. (50 pts) After you create the players array, write the following functions a)printOffensive (offense) that prints only the offensive statistics of a single player that you pass to the function (10 pts) Sample Output: Offensive: 3465 Hits 260 HR.310 BA 1923 R 1311 RBI 358 SB 377 OBP 440 SLG 0.817 OPS 5 Silver Sluggers b)printDefensive defense&c) that prints only the defensive statistics of a single player that you pass to the function(10 pts) Sample Output: Defensive: 3820 PO 6605 A 254 E 976% Fid 5 Golden Gloves c)printPlayer(player&) that calls printOffensive and printDefensive functions, alongside extra player data to print the entire statistics of the player, represented as a Player Card in the following form: (50 pts) An example player card looks like so: (You should call print Defensive and printOffensive functions defined above) ------- --------------------------------- EEEEEEEEEEEEEEEEEEEEEEEEEEECSC 102 Baseball Card ESSEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE Derek Jeter New York Yankees Short Stop Right 190 cm 88kgWAR:72.4 HOF* 5* All Star Offensive: 3465 Hits 260 HR .310 BA 1923 R 1311 RBI 358 SB 377 OBP 440 SLG 0.817 OPS 5 Silver Sluggers Defensive: 3820 PO 6605 A 254 E 976% Fld 5 Golden Gloves ===========================Thank you for Buying ======== For the subsequent operations, you will be printing a similar type of Player Card as a result of search/sort operations. d) create a function searchByName(string) that asks the user for the first name of the player and prints the Player Card (similar to the visual format of Section c) (30 pts) e) Print the Player Card of all the players who are in the Hall of Fame (in the data file represents Not eligible for HOF, elsewise any other player is HOF) (20 pts) f) Export the player Card of the people whose WAR value is greater than 70 into the file war_70.txt (Similar to printing the player cards to the console, but this time you need to print them in the file (30 pts) g) Export the player Card of the people who had more than 100 Stolen Bases into the file stolenbase_100.txt (Similar to printing the player cards to the console, but this time you need to print them in the file) (30 pts) Bonus: 8) Sort the players by their WAR value and print the top 3 players by their WAR. (80 pts) h) Export the player Card of all the players who won the Silver Slugger and Golden Glove award in the same year(s) at least one (At least 1 common item in the Silver Slugger Years array and the golden glove years) (50 pts) This is a Baseball Player Statistics program where you will be storing actual data of baseball players using structures and doing operations on them. The file baseballdata.txt has the data of 11 baseball players and multiple attributes related to their statistics. The schema of the data file is reflected in the file baseballdatadescription.txt : which describes what are the statistics in the data file of the player, and it holds the same for all the players. You will start by creating 3 different structures : a) offense: houses the offensive statistics of the players (Hits, HomeRuns, BattingAverage, Runs, RBI, stolen base, OBP. Slugging. OPS, Silver Slugger Years) b) defense: houses the defensive statistics of the players (Putouts, Assists, Errors, Fielding%, Golden Glove Years) c) players which nests the offense and defense structures and stores other extra metadata of the players(Name, Position, Bats, Height, Weight. DraftedBy, Halloffame. AllStarGames) You need to parse the baseballdata.txt file and create an array of players, with all of their statistics loaded from the incoming file. The statistics include various types of primitive data elements such as float, integer, strings, booleans, and arrays. You should be able to determine the appropriate type for appropriate statistics by observing the file. Take the reference of baseballdatadescription.txt and make sure that your players have all of the statistics loaded. (50 pts) After you create the players array, write the following functions a)printOffensive (offense) that prints only the offensive statistics of a single player that you pass to the function (10 pts) Sample Output: Offensive: 3465 Hits 260 HR.310 BA 1923 R 1311 RBI 358 SB 377 OBP 440 SLG 0.817 OPS 5 Silver Sluggers b)printDefensive defense&c) that prints only the defensive statistics of a single player that you pass to the function(10 pts) Sample Output: Defensive: 3820 PO 6605 A 254 E 976% Fid 5 Golden Gloves c)printPlayer(player&) that calls printOffensive and printDefensive functions, alongside extra player data to print the entire statistics of the player, represented as a Player Card in the following form: (50 pts) An example player card looks like so: (You should call print Defensive and printOffensive functions defined above) ------- --------------------------------- EEEEEEEEEEEEEEEEEEEEEEEEEEECSC 102 Baseball Card ESSEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE Derek Jeter New York Yankees Short Stop Right 190 cm 88kgWAR:72.4 HOF* 5* All Star Offensive: 3465 Hits 260 HR .310 BA 1923 R 1311 RBI 358 SB 377 OBP 440 SLG 0.817 OPS 5 Silver Sluggers Defensive: 3820 PO 6605 A 254 E 976% Fld 5 Golden Gloves ===========================Thank you for Buying ======== For the subsequent operations, you will be printing a similar type of Player Card as a result of search/sort operations. d) create a function searchByName(string) that asks the user for the first name of the player and prints the Player Card (similar to the visual format of Section c) (30 pts) e) Print the Player Card of all the players who are in the Hall of Fame (in the data file represents Not eligible for HOF, elsewise any other player is HOF) (20 pts) f) Export the player Card of the people whose WAR value is greater than 70 into the file war_70.txt (Similar to printing the player cards to the console, but this time you need to print them in the file (30 pts) g) Export the player Card of the people who had more than 100 Stolen Bases into the file stolenbase_100.txt (Similar to printing the player cards to the console, but this time you need to print them in the file) (30 pts) Bonus: 8) Sort the players by their WAR value and print the top 3 players by their WAR. (80 pts) h) Export the player Card of all the players who won the Silver Slugger and Golden Glove award in the same year(s) at least one (At least 1 common item in the Silver Slugger Years array and the golden glove years) (50 pts)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started