1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
Your Task
You’ll read in data from three different text files:
Team member names for team A, a Team Member Input File
Team member names for team B, a Team Member Input File
Laser Tag Match file giving information about what player successfully tagged another, a Match File
Your program will aggregate the data from the Match File to be used for output. Let’s take a look at each input file type.
Team Member input file
The first line of this file will contain the team name. The name of the team may contain spaces.
The second line of this file will contain a positive integer 1 < n <= 10 representing the number of members on the team.
The next n lines will contain team member’s id number (a positive integer), a single space, and the team member’s name. Names may contain spaces.
The name of the file will be provided via a command-line argument when the program is executed. As to be expected, each execution of the program will require two different Team Member input files.
Match File
The first line of the file will contain a positive integer 1 < n <= 100000 representing the number of ‘tags’ that happened during a particular match
The next n lines will contain 4 fields each separated by a single space:
Field 1: Tagger’s ID number, a positive integer
Field 2: Target’s ID number, a positive integer
Field 3: Number of milliseconds since the match started, a positive integer
Field 4: Location ID where target was hit (chest, back, shoulder, etc), a positive integer
For each execution of the program, only one Match File will be used.
Tag Scoring
The score received for a tag depends on the location the target was tagged. Locations have the following ID’s and point values:
1 (Back): 5 points
2 (Chest): 8 points
3 (Shoulder): 10 points
4 (Laser gun): 15 points
Output File
All results should be written to an output file. Your program should have three different verbosity levels of output:
Low verbosity (vlow): Output the cumulative score of each team on a separate line and on line 3, output the winning team. If there is a tie, state such instead of a winning team.
Medium Verbosity (vmed): For both teams, output the team name and then each team members name followed by the number of successful tags they achieved (i.e., how many total times they successfully tagged another player). Then output the highest-ranking member for each team followed by the winning team.
High Verbosity (vhigh): Print the team name. Then, for each player on a team, list each player on the opposing team that they tagged and the number of tags achieved against that player. This should be followed by the total number of tags for that player. After all of the players for one team have been output, print the total score for that team. After player detail for both teams have been output, output the winning team.
Command-Line Parameters
The input data files and verbosity level will be passed to the program as command-line parameters. The parameters will have the following order, where verbosity is one of vlow, vmed, or vhigh mentioned above:
./a.out TeamA.txt TeamB.txt MatchFile.txt OutputFile.txt verbosity
Put the code you need help with here.
|