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
COMP Computer Programming I Semester Assignment Date Due: Sunday November th @ pmOverviewThe ICC Mens T World Cup Cricket tournament was held in the West Indies and the USA from June The file, tworldcupbattingstats.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 Your program should start by requesting the user to specify the name of a team that participatedin the World Cup. Read the data for each player from the file, tworldcupbattingstats.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, countrybattingstats.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 statement or the return statement When all the required data has been read from the tworldcupbattingstats.txtfile and the relevant data written to the output file, countrybattingstats.txt file, insert theword END as the last line in the output file. Then, close both files. Open the countrybattingstats.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 display asterisksTo display a certain number of asterisks on the monitor, a function has been provided, printStars.To display asterisks, call the function as follows: printStars To display asterisks, call thefunction as follows: printStars In general, to display n asterisks where n is an integer, call thefunction as follows: printStars nAfter producing the histogram, indicate how many rows of players were read from the file. While processing the countrybattingstats.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 T World Cup tournament is Itwas scored by VKohli from India in the tournament. For the player who made thehighest number of runs in the tournament, find the difference between his score andthat of VKohli.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 T World Cup tournament is made by BBMcCallum from New Zealand against Bangladesh in the tournament.For the player with the highest score in the tournament, find the difference between hisscore and that of BBMcCallum.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 runs in innings but hadtwo not outs, the average number of runs for that player is ieNB: Do not perform the division if the number of innings number of not outs is equal tozero. Instead, assign 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. 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, tworldcupbattingstats.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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
