Question: Learning Objectives: - reading data from a structured text file into a prograrm writing data to a structured text file from a program adding Resource


Learning Objectives: - reading data from a structured text file into a prograrm writing data to a structured text file from a program adding Resource Files to a Visual Studio project General Description: For a baseball player, the batting average is defined as the number of times the player hit the ball divided by the number of attempts ("at bats"). If the number of at bats is 0, the batting average is 0.0. The data for a player consists of the player's name, number of Hits, number of At Bats, and Batting Average. Write a program that reads a team roster from a file, calculates the batting average for each player, and writes the results to another file. (The idea is, later, another program will read this file as it's input file...but we won't write that program for this lab) Specifications: Input File: Line 1 will contain the number of players. Each subsequent line will have data for one player including: Name (no spaces) Number of "at bats" (attempts) Number of hits Example input file: JOINER 25 24 BURTON 23 2 BROWN 20 11 Output File: There will be one line for each player written, consisting of the Name and Batting Average with a space between. An additional line is written at the end as a Sentinel Data. It consists of EOF 0.0 Example output file: JOINER 0.96 BURTON 0.09 BROWN 0.55 EOF 0.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
