Project #4
Totally Fantasy Baseball
( Due 26 October 2007
)
Each year fantasy baseball teams are formed from comics strip characters and they play in the "Comics World Series". This year the two teams, the Comics Clowns and the Strip Stalkers met and the statistics from the games were written to the file scorebook.txt The Comics World Series is a bit different from the real World Series. The teams always play seven 9-inning games and the winner of the series is the team that scores the most runs in all seven games combined. You are to write a program to process the scorebook.txt file and produce an analysis of the players and the teams. The file has the following format:
Each line represents one player and shows
Name Team Number-of-games-played and for each game played the number of at bats, number of hits and number of runs scored. The following shows the first few lines of the file.
Arbuckle, Jon
SS 7 3 1 1 3 0 0 5 3 1 3 0 0 4 0 0
3 0 0 4 1 0
Brown, Buster
CC 0
Brown, Charlie
CC 3 1 0 0 1 1 0 1 0 0
Btfsplk, Joe
CC 7 3 1 0 3 0 0 4 2 0 4 0 0 4 1 0
4 1 0 4 0 0
Bumstead, Alexander SS
4 1 0 0 1 0 1 1 0 0 1 1 0
The players are listed in the file in alphabetical order with the names as last, first and the team abbreviated to CC for Comics Clowns or SS for Strip Stalkers. In this sample, Jon Arbuckle of the Strip Stalkers played in all 7 games; in the first, he batted 3 times, had one hit and scored once; in the second, he batted 3 times with no hits or runs. Buster Brown did not play; Charlie Brown of the Comics Clowns played in 3 games, batting once in each game with only one hit. Joe Btfsplk played in all 7 games; Alexander Bumstead played in only 4 games.
Your program is to read this data and display the following:
Here is a sample of what the first part of this output might look like.
Name
Team Games Average
Arbuckle, Jon
SS 7 0.200
Brown, Buster
CC 0 0.000
Brown, Charlie
CC 3 0.333
Btfsplk, Joe
CC 7 0.192
Bumstead, Alexander
SS 4 0.250
The scorebook.txt file can be obtained from the I: drive at I:\jlwolfe\110\scorebook.txt
Hand in a well-documented printout of your
program and a printout of the captured output, showing the individual batting
averages, the MVP with average, and the required team results. Also,
copy the program's .cpp file to the handin folder on the P: drive for COSC
110 section 003. Be sure to name the .cpp file after yourself so
that it can be distinguished from other student file names. For example,
I would name my file
wolfep4.cpp