Question
The Dubuque Table Tennis Club wants a prototype program to process the scores of a 3-person round robin. The 3 players are designated as player
The Dubuque Table Tennis Club wants a prototype program to process the scores of a 3-person round robin. The 3 players are designated as player A, player B and player C. In a round robin of 3 players, player A plays player B in a match of the best of 3 out of 5 games. Player B then plays player C, and finally player C plays player A.
A table tennis game is played such that the first player to 11 wins. However, the player must win by at least 2 points. So game scores of 11 to 0, 11 to 9, 12 to 10, and 21 to 19 are legitimate. Game scores of 4 to 1, 12 to 9, 8 to 5, and 10 to 8 are NOT legitimate. In addition, any negative scores should be immediately rejected. See the sample runs on exactly how to re-prompt the user for incorrect game scores.
The program is to print the winner of the round robin. The winner of the round robin is the person who either wins both their matches or if all three players have each won one match, the player with the better won-loss record. As one can see in Sample Run # 1 below, player A won 3 games and lost 4, player B won 4 games and lost 5, and player C won 5 games and lost 3. Player A has a winning percentage of (3.0 / (3 + 4)) which is about 42.9%, player B has a winning percentage of (4.0 / (4 + 5)) which is about 44.4%, and player C has a winning percentage of (5.0 / (5 + 3)) which is 62.5%. So Player C is the winner of the round robin because Player C has the best winning percentage.
Lastly, note that there are scenarios in which there is NO clear winner solely based on number matches won and number of games won and lost. As in Sample Run # 2, each player won one match 3 wins to 0 losses and each finished the match with 3 games won and 3 games lost. When a scenario like this occurs, the program should print the following message:
There is no clear winner.
NOTE: For this program there is NO clear winner if each of the 3 players
wins one match and each player has the same number of wins.
NOTE: In an actual tournament for the "NO clear winner" case,
the tournament director would total number of points scored
by each player. THIS PROGRAM SHOULD NOT TOTAL POINTS SCORED!
In particular note the following requirement for the File Comment block and the -3 penalty for non-compliance:
Both persons in the group must do their fair share of work for the program. The header block at the top must contain each person's estimate of what percent each member contributed to the completion of the program. The percentages must add up to one hundred. For example:
Sally Smith: Sally - 60%, J Jacobs - 40%
John Jacobs: Sally S - 50%, John - 50%
Expect to lose up to 3 points on the program if this is not done.
If there are significant differences in what is reported (estimated), the instructor can call in the group to discuss.
The following additional requirements must be followed:
A. Your main function should adhere to the following pseudocode:
--- Pseudocode ----
Process one match of player A versus player B
Process one match of player B versus player C
Process one match of player C versus player A
Print the heading
Print the player results for player A
Print the player results for player B
Print the layer results for player C
if there is no clear winner then
write "There is no clear winner."
else
print winner
B. The above pseudocode suggests some functions.
Keep these functions single-minded, performing a focused task that can be well-named. You should design pseudocode for each of these functions.
All function bodies, including the body of main, should be NO more than 30 lines long, including braces, blank lines and comments.
C. You must NOT use arrays or structures.
D. You must follow the programming ground rules.
E. You must follow the formatting of the sample I/O below.
F. You must thoroughly test your program.
G. You must use the following functions and you MUST add the documentation for the parameters to these functions.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started