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...
-
Jeremy Zabel operates his own catering service. Summary financial data for February are presented in equation form as follows. Each line designated by a number indicates the effect of a transaction...
-
Consider a plane electromagnetic wave incident normally on an infinite plane plasma slab occupying the space 0 x L, with vacuum for x < 0 and x > L, as indicated in Fig. 30. Use the following...
-
Why do bond issuers accept restrictive covenants?
-
Metro Industries is considering the purchase of new equipment costing $1,200,000 to replace existing equipment that will be sold for $180,000. The new equipment is expected to have a $200,000 salvage...
-
What is Pro-Forma Financial Statement and why is it important to a business? What are recommended approaches to prepare Pro-forma Financial Statements for a small business based on your research?
-
The company has made the following profit-sharing contributions to the retirement plan for Archie and Elaine for each of the related years. 2021 2020 2019 2018 2017 2016 Balance 1/1/16 Archie None...
-
Your Uncle Jamie wishes to invest some money in either Bond A or Bond B. Bond A has a face value of $1,000, a coupon rate of 6%, a date to maturity of 3 years, and a current price of $1,000. Bond B...
-
Discuss the significance of discounting in business decision making.
-
Define corporate governance. Does this definition change as the entrepreneurial firm matures?
-
Discuss the major problems with acquisitions. Why are acquisitions often less suitable for entrepreneurial firms?
-
Nova Land Development Corporation is a closely held corporation engaged in purchasing large tracts of land, subdividing the tracts, and installing paved streets and utilities. The corporation does...
-
Differentiate between the external and internal growth approaches for entrepreneurial firms.
-
Interest rates on 4-year Treasury securities are currently 6.0%, while 6-year Treasury securities yield 7.85%. If the pure expectations theory is correct, what does the market believe that 2-year...
-
What is master production scheduling and how is it done?
-
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...
-
Since opening its doors in Hawaii two years ago, Oriental Trading has enjoyed tremendous success. As a wholesaler, Oriental Trading purchases textiles from Asian markets and resells them to local...
-
Ashton Fleming has worked furiously for the past month trying to document the major business information flows at S&S. Upon completing his personal interviews with cash receipts clerks, Ashton asks...
-
A partially completed flowchart appears in Figure 3-13. The flowchart depicts the credit sales activities of the Bottom Manufacturing Corporation. A customers purchase order is received, and a...
Study smarter with the SolutionInn App