Problem
The local baseball team is computerizing its records. You are to write a program that computes batting averages. There are 20 players on the team, identified by the numbers 1 through 20. Their batting records are coded on a file as follows. Each line contains four numbers: the player's identification number and the number of hits, walks, and outs he or she made in a particular game.
Example Input Line
3 2 1 1
The example indicates that, during this game, player number 3 was at bat 4 times and made 2 hits, 1 walk, and 1 out. For each player there are many lines in the file-one for each game played. Each player's batting average is computed by adding the player's total number of hits and dividing by the total number of times at bat. A walk does not count as either a hit or a time at bat when you calculate the batting average. Your program prints a table showing each player's identification number, batting average, and number of walks. This problem also appeared where you were to solve it with files. Which solution is best?