Tennis scoring is similar to other games, but it has been cleverly encoded to sound strange...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Tennis scoring is similar to other games, but it has been cleverly encoded to sound strange to non- tennis fans. Write a C++ program to keep track of the score of a tennis game. When two players play each other in tennis, they are playing a tennis match. The overall objective is to win the match. A tennis match is made up of sets, and a set is made up of games. This problem will only involve scoring a single game not a match or a set. A tennis game is made up of points. A player wins a tennis game by being Updated September 1, 2020 the first player to win four points but must win by two. There are no tiebreakers in games. The clever encoding of tennis scores comes at the point level. The following table describes the different names for tennis points: Number of Points Won 0 123 Name of Score love 15 30 48 4 COSC 1437 F20 Tennis scores are usually separated by a dash with the server's score first, and in this problem player 1 will always be serving. Some example scores are 15-30 and 40-love. When the score is tied, tennis does things a little differently. Tie scores of 15-15 and 30-30 are called "15-a11" and "30-all" respectively. After this point, when the score is tied at 40-40 or beyond, the score is referred to as "Deuce". Once a deuce situation is encountered, the score is called out according to which player has the "Advantage", meaning the player that needs to win the next point to win the game. So, after a deuce the only two possible scores would be "Advantage Player 1" or "Advantage Player 2". Depending on who wins the point after that, either the game is over, or the score is tied at deuce again. The input text file will contain an unknown number of lines. Each line will either contain a 1 or a 2, signifying which player won the point. The program should print out the score of each game as it progresses. At the beginning of each game, you should print the text "Game Start", and when a game is won you should print "Game Player x", where x is the number of the player that won. The program should play as many games as it can until the input runs out. Let the user input the file name from the keyboard. Refer to the sample output below. Sample File: 1 1 2 1 1 1 1 2 1 2 1 1222 2 Sample Run: Enter file name: tennis.txt Game Start 15-love 30-love 30-15 40-15 Game Player 1 Game Start 15-love. 15-all 30-15: 30-all 40-30 Deuce Advantage Player 1 Deuce Advantage Player 2 Game Player 2 Name the program: TennisGameXX.cpp, where XX are your initials. Tennis scoring is similar to other games, but it has been cleverly encoded to sound strange to non- tennis fans. Write a C++ program to keep track of the score of a tennis game. When two players play each other in tennis, they are playing a tennis match. The overall objective is to win the match. A tennis match is made up of sets, and a set is made up of games. This problem will only involve scoring a single game not a match or a set. A tennis game is made up of points. A player wins a tennis game by being Updated September 1, 2020 the first player to win four points but must win by two. There are no tiebreakers in games. The clever encoding of tennis scores comes at the point level. The following table describes the different names for tennis points: Number of Points Won 0 123 Name of Score love 15 30 48 4 COSC 1437 F20 Tennis scores are usually separated by a dash with the server's score first, and in this problem player 1 will always be serving. Some example scores are 15-30 and 40-love. When the score is tied, tennis does things a little differently. Tie scores of 15-15 and 30-30 are called "15-a11" and "30-all" respectively. After this point, when the score is tied at 40-40 or beyond, the score is referred to as "Deuce". Once a deuce situation is encountered, the score is called out according to which player has the "Advantage", meaning the player that needs to win the next point to win the game. So, after a deuce the only two possible scores would be "Advantage Player 1" or "Advantage Player 2". Depending on who wins the point after that, either the game is over, or the score is tied at deuce again. The input text file will contain an unknown number of lines. Each line will either contain a 1 or a 2, signifying which player won the point. The program should print out the score of each game as it progresses. At the beginning of each game, you should print the text "Game Start", and when a game is won you should print "Game Player x", where x is the number of the player that won. The program should play as many games as it can until the input runs out. Let the user input the file name from the keyboard. Refer to the sample output below. Sample File: 1 1 2 1 1 1 1 2 1 2 1 1222 2 Sample Run: Enter file name: tennis.txt Game Start 15-love 30-love 30-15 40-15 Game Player 1 Game Start 15-love. 15-all 30-15: 30-all 40-30 Deuce Advantage Player 1 Deuce Advantage Player 2 Game Player 2 Name the program: TennisGameXX.cpp, where XX are your initials.
Expert Answer:
Answer rating: 100% (QA)
include include using namespace std main string filename pointname5 love 15 30 40 int score point10 ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
A music player or music organization program can keep track of how many different artists are in a library. First note how many different artists are in your music library. Then find the probability...
-
Write a C program called reservations.c that simulates some people trying to reserve seats at a restaurant for dinner. The program MUST work as follows: The restaurant takes reservations anywhere...
-
Write a c program to implement phone book dictionary using Binary Search Tree which provides following operations: (a) add new entry in phone book, (b) remove entry from phone book, (c) search phone...
-
Which of the following statements correctly describes the reporting of cash? (a) Cash cannot be combined with cash equivalents. (b) Restricted cash funds may be combined with cash. (c) Cash is listed...
-
Sean is 42 years old. His employer provides him with $300,000 of group term life insurance as a fringe benefit. The policy costs his employer $40 per month. For tax purposes, how much income does...
-
How does the concept of a "deadlock-free" system align with the practical realities of resource management in operating systems, and what are the potential drawbacks of striving for complete deadlock...
-
To the left of z = 1.625 Find the indicated area under the standard normal curve. If convenient, use technology to find the area.
-
Data for Rajesh Company are presented in P17-7A. Further analysis reveals the following. 1. Accounts payable pertain to merchandise suppliers. 2. All operating expenses except for depreciation were...
-
The Conference Board Economic Forecast for the US Economy August 02, 2023 | Report The Conference Board forecasts that the growth seen in many parts of the economy will gradually buckle under...
-
Mrs. Yacumflastor, who is 68 years old, has correctly computed the following separate amounts in respect of income for tax purposes in 2023 for both her and her husband, who is 66 years old. (Amounts...
-
So far, for simplicity, we described a closed economy, i.e., an economy that does not trade with other countries. Suppose we reintroduce exports (EX) and imports (IM). Exports are given by Equation...
-
In addition to conducting an audit of the hotel's lighting systems, you have been assigned the responsibility of exploring viable options for the hotel to embrace renewable technologies as means to...
-
1. The data shows the scores obtained by 33 participants in a quiz. 36 37 37 20 52 11 40 15 25 29 51 40 63 32 45 34 49 68 33 31 41 50 60 59 43 18 44 39 32 64 21 56 13 Using Sturges Rule, construct a...
-
Compute each segment's revenue as a percentage of IBM total revenues by quarter. (Formula for segment's revenue as a percentage=segment's revenue total revenue x 100) 2016 Segment's revenue as...
-
How are properties of neighbours propagated in graph neural nets? Match each approach with its name scalar f(neighbour) scalar f(node, neighbour) vector f(node, neighbour) Attention O. O O This...
-
Boys of a certain age in the nation have a mean weight of 86 with a variance of 86.49 lb. A complaint is made that boys are overfed fed in a municipal children's home. As evidence, a sample of 22...
-
Today's rate for the USD/MXN is 22.08. Mexico's 1-year interest rate is 5.7%. US 1-year interest rate is 2.8%. What is the forecast for the pair for next year?
-
14. In testing the existence assertion, an auditor ordinarily works from the a. Financial statements to the accounting records. b. General journal to the general ledger. c. Supporting evidence to the...
-
At January 1, 2013, Berke Ltd. acquired all the shares of Tauber Ltd. for $283,000. At this date the equity of Tauber consisted of: Share capital100,000 shares ...$200,000 Retained earnings...........
-
The consolidated nancial statements of Dataserve Submarine Works are being prepared by the group accountant, Raz Kawatra. He is currently in dispute with the auditors over the need to adjust for the...
-
John "Calc" Gossling is one of Canada's foremost real estate investment analysts. He works for the firm of Bouchard Wiener Securities Inc. (BWS). His job is to do research and make recommendations on...
-
Find the maximum of the function using Trust region method \(f=15 x_{1}+8 x_{1} x_{2}+5 x_{2}\) subject to \(x_{1}+x_{2} \leq 10\)
-
Define trust region fidelity.
-
Calculate the reduction ratio \(r_{k}=\frac{f\left(X_{k} ight)-f\left(X_{k}+s_{k} ight)}{m_{k}\left(X_{k} ight)-m_{k}\left(X_{k}+s_{k} ight)}\) for the function given in problem 1 .
Study smarter with the SolutionInn App