Question: Write a C++ program using functions to simulate a tennis singles match. If you follow the game of tennis you are aware of the scoring
Write a C++ program using functions to simulate a tennis singles match. If you follow the game of tennis you are aware of the scoring system, 15, 30, 40, game. Then, of course there is 40-40 or deuce, with one player having to get 2 points ahead to win a game. Thus, to win a game a player needs to score 4 points, but also to be 2 points ahead. For example, the first game is represented by ABAABBAA and player A has won it. It went to deuce then player A won two points. The second game was represented by BABAABABBB. This game was won by player B. Again, it went to deuce, player A went ahead by 1 but player B caught up. Player B then won the last 2 points. After all that, the score would be 1 game all. Assume that the two players in a tennis match are each assigned a skill level from 0 to 10. The higher the skill level, the more likely that player is to win a particular point. For example, if player 1 and player 2 have identical skill levels, say 6.5 and 6.5, each is equally likely to win a given point. However, if player 1 has a skill level of 6.5 and player 2 has a skill level of 3.25, then player 1 is twice as likely to win a given point. For example, in Python (in Ping Pong): The function listed above simulates a single point in a ping pong match and returns the winning player number (1 or 2). We will adjust it to simulate it for a single point in tennis (TennisPoint). The function should have two real numbers as input between 0 and 10 indicating a play level for each player (10 is the best). Other functions to use in the program: TennisSet()-Simulates a complete game of tennis by calling TennisPoint. TennisMatch()-Simulates a complete game of tennis by calling TennisSet. Let the user input the players by number (Player 1, etc.) as well as their skill levels. The program should output players, each point, set, and games won, and the overall match winner. Output should be user friendly.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
