Question: 1 COMP 1 6 0 1 Computer Programming I 2 0 2 4 / 2 0 2 5 Semester 1 Assignment 2 Date Due: Sunday

1COMP 1601 Computer Programming I2024/2025 Semester 1Assignment 2Date Due: Sunday November 10th,2024 @ 11.30 pmOverviewThe ICC Mens T20 World Cup Cricket tournament was held in the West Indies and the USA from June1-29,2024. The file, t20_world_cup_2024_batting_stats.txt, contains the batting statistics ofeach player in the tournament. Each row in the file contains the following data on one player:PlayerNameTeamName#Matches#Innings# NotOuts# Runs HighestScoreStrikeRate#Hundreds# FiftiesThe number of players in the file is unknown beforehand but a player name of END indicates thatthere are no more players in the file.This assignment requires you to write a program which generates some additional statistics on a teamspecified by the user at the keyboard.NB: You do not need to understand the game of cricket to do this assignment. You should focus onthe data and how to process the data to produce the required results.Program Requirements(1) Your program should start by requesting the user to specify the name of a team that participatedin the 2024 World Cup.(2) Read the data for each player from the file, t20_world_cup_2024_batting_stats.txt. If theplayers team is the same as the one specified by the user, write the following data on the playerin one line of a new output file, country_batting_stats.txt, in the order specified:PlayerName# Matches # Innings # NotOuts# Runs HighestScore# Hundreds # FiftiesNB: Data from the Team Name and Strike Rate columns in the input file should be omitted fromthe output file.If no players are found for the team specified by the user, your program should display a messageand terminate (by using the exit (1) statement or the return (1) statement).(3) When all the required data has been read from the t20_world_cup_2024_batting_stats.txtfile and the relevant data written to the output file, country_batting_stats.txt file, insert theword END as the last line in the output file. Then, close both files.(4) Open the country_batting_stats.txt file and read the data on each player. As the data is beingread, generate a histogram on the batting statistics of each player. One asterisk must be displayedfor every ten runs scored by a player. If this works out to a fractional number of asterisks, x, displayy asterisks, where y is the smallest integer bigger than x. So, if x is 12.3, display 13 asterisks.2To display a certain number of asterisks on the monitor, a function has been provided, printStars.To display 5 asterisks, call the function as follows: printStars (5). To display 8 asterisks, call thefunction as follows: printStars (8). In general, to display n asterisks where n is an integer, call thefunction as follows: printStars (n).After producing the histogram, indicate how many rows of players were read from the file.(5) While processing the country_batting_stats.txt file, write code to find out the following:(a) The player who made the highest number of runs in the tournament and the player who madethe second highest number of runs. Note that the total number of runs scored by a player isin the # Runs column.The highest number of runs scored by a player in an ICC T20 World Cup tournament is 319. Itwas scored by V_Kohli from India in the 2013/2014 tournament. For the player who made thehighest number of runs in the 2024 tournament, find the difference between his score andthat of V_Kohli.(b) The player who made the highest individual score in a match for the given team (under theHighest Score column). The highest individual score in an ICC T20 World Cup tournament is123, made by BB_McCallum from New Zealand against Bangladesh in the 2012 tournament.For the player with the highest score in the 2024 tournament, find the difference between hisscore and that of BB_McCallum.NB: Suppose that a players highest score is stored as a negative number, x. The actual scoreof the player is -x. The negative number indicates that the player was not out when hestopped batting.(c) Find and display the name of the player who scored the smallest total number of runs in thetournament.(d) Find and display the name of the player who scored the highest average number of runs inthe tournament. The average is calculated by dividing the number of runs by (the number ofinnings number of not outs). For example, if a player scored 210 runs in 6 innings but hadtwo not outs, the average number of runs for that player is (210/(62)(i.e.,52.5).NB: Do not perform the division if (the number of innings number of not outs) is equal tozero. Instead, assign 0 to the average.(e) The total number of fifties and the total number of hundreds scored by all the players in theteam during the tournament.(6) You should review the Sample Output document to find out what your output should be for thisassignment. Your output does not have to look the same. However, numeric values should beidentical to what is shown in the document.FilesThe data file, t20_world_cup_2024_batting_stats.txt together with a .cpp file containing theprintStars function can be downloaded from myeLearning as a zipped file. Submit your program for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!