PGA Tour Prize Money |
A PGA (Professional Golf Association) Tour event is a golf tournament in which prize money is awarded to the best players. The tournament is broken into four rounds of 18 holes apiece. All players are eligible to play the first two rounds. Only those with the best scores from those 36 holes ``make the first cut" to play the final two rounds and qualify for prize money. Players with the best 72-hole aggregate scores (the lowest scores) earn prize money.
You must write a program to determine how the total prize money (called the tournament ``purse") is to be allocated for a tournament. Specifications are as follows.
The input file is broken into two segments. The amount of the tournament purse and the percentages for all the 70 places are stored in the first segment of the input file. This segment contains exactly 71 lines, which are formatted as follows.
Line 1: Total value of the purseLine 2: Percentage of the purse designated for first place
Line 3: Percentage of the purse designated for second place
...
Line71: Percentage of the purse designated for 70th place
All entries in the first 71 file lines can be read as real numbers. All percentages are given to four decimal places. Assume the percentages are correct and sum to 100%. A partial sample of the first segment of the input file is shown below.
1000000.00 18.0000 10.8000 6.8000 4.8000 ... 0.2020 0.2000
The second segment of the input file contains the players' names and their respective scores for the four rounds. There is a maximum of 144 players. The format of each line is as follows.
Characters 1-20: Player nameCharacters 21 23: Round 1 score (first 18 holes)
Characters 24-26: Round 2 score (second 18 holes)
Characters 27-29: Round 3 score (third 18 holes)
Characters 30-32: Round 4 score (fourth 18 holes)
Any player who has an asterisk `*' at the end of his last name is an amateur. All players who are not disqualified will have four 18-hole scores listed. (Even though in an actual tournament, players who do not make the cut do not get to play the last two rounds of the tournament, for the purposes of this program all players who are not disqualified will have four 18-hole scores listed.) A player who is disqualified during a round will have a score on that round shown as `DQ'. That player will have no additional scores for the tournament. Assume that at least 70 players will make the 36-hole cut. The end of input is denoted by end-of-file.
Sample lines from the second segment of the input file are as follows.
WALLY WEDGE 70 70 70 70 SANDY LIE 80 DQ SID SHANKER* 100 99 62 61 JIMMY ABLE 69 73 80 DQ
Output from this program consists of names of all players who made the 36-hole cut, their finish positions (with the letter ``T" after the numeric value representing the finish position if there is a tie for that position), scores for each round, total scores, and the amounts of money won. Disqualified players are listed at the bottom with scores of DQ placed in the ``TOTAL" column; the order among disqualified players is unimportant. No player who failed to make the 36-hole cut is listed in the output. Each column of output should be formatted and labelled appropriately. The dollar amounts should be correct to two decimal placas. Sample output is shown below:
Player Name Place RDJ RD2 RD3 RD4 TOTAL Money Won ----------------------------------------------------------------------- WALLY WEDGE 1 70 70 70 70 280 $180000.00 TOMMY TWO IRON 2T 71 72 72 72 287 $ 88000.00 HENRY HACKER 2T 77 70 70 70 287 $ 88000.00 NORMAN NIBLICK* 3 72 72 72 72 288 BEN BIRDIE 3 70 74 72 72 288 $ 48000.00 ... LEE THREE WINES 70 99 99 99 99 396 $ 2000.00 EDDIE EAGLE 71 71 DQ JIMMY ABLE 69 73 80 DQ