Assume a sport in which two players

  

Assume a sport in which two players (A and B) score points and the winner is a player who has at least 4 points and wins by at least 2 points.
The following diagram shows the structure of the program.
Function point() Prompts the user for the player who wins a point. The function: • Returns “A” if the user enters “A” or “a” to indicate that player A wins. • Returns “B” if the user enters “B” or “b” to indicate that player B wins. • Returns “Q” if the user enters “Q” or “q” to quit the program. • Returns “E” if user enters anything else.
Function game() uses indefinite (while) loop until the game is finished or the user quits. In each iteration of the loop: • Calls function point() to get input from the user. • Increments score of the player A if point() returns “A”. • Increments score of player B if point() returns “B”. • Quits the program if point() returns “Q”. • Prints error message if point() returns “E”. • If the game is over, prints the winner and returns to main(), which terminates the program. • Calls function display() to print the score of the game. Game is over and the winner is a player who has at least 4 points and wins by 2 points.
Write function point() that prompts the user for a player who wins a point and returns “A” if player A wins, “B” if player B wins, and ”Q” if the user quits the game. Write function game() that keeps the score in the game and prints the winner of the game. Write function display() that prints the current score in accordance with tennis rules for a game. Function main() just calls function game().
Function display(scoreA,scoreB) Input are scores (positive integers) of the player A and B. Mapping of the first 3 points to displayed values: 0 point displayed as 0 1 point displayed as 15 2 points displayed as 30 3 points displayed as 40 Deuce means that both players have at least 3 points and same number of points. Deuce is displayed as 40 for both players. After a deuce, the score for the player who has 1 more point is displayed as “Adv” and the score of the other players as “ “ (empty string).
Function main() just calls function game().
Sample printouts:
The program keeps a score and prints winner in a tennis game. Who wins a point, player A or player B? A Score of Player A: 15 Score of Player B: 0
Who wins a point, player A or player B? b Score of Player A: 15 Score of Player B: 15
Who wins a point, player A or player B? C Invalid input. Please enter A, B or Q (to quit).
Score of Player A: 15 Score of Player B: 15
Who wins a point, player A or player B? a Score of Player A: 30 Score of Player B: 15
Who wins a point, player A or player B? q You quit the game.
Deliverables • Write your programs in Python 3. • Make sure your code is properly formatted, structured and commented. • Write a separate program (Python script) for each question or subquestion. Each program has to have a ‘main()’ function from which you should call all other functions (if you have any). • Name program files ‘Question1.py’, ‘Question2.py’, etc. • A program should run the entire code for that particular question by directly executing it. • Submit a single zip file that includes all the question program files together. Name the zip file ‘IU-user-name_assignmentNumber.zip’. For example, if your IU username is ‘rakshah’, your zip file will have name ‘rakshah_assignment5.zip.’ • If you want to provide more instructions for executing your code, put a ‘readme.txt’ file inside of this zip file, where you may provide additional information.
Who wins a point, player A or player B? a Score of Player A: 15 Score of Player B: 0
Who wins a point, player A or player B? A Score of Player A: 30 Score of Player B: 0
Who wins a point, player A or player B? b Score of Player A: 30 Score of Player B: 15
Who wins a point, player A or player B? b Score of Player A: 30 Score of Player B: 30
Who wins a point, player A or player B? a Score of Player A: 40 Score of Player B: 30
Who wins a point, player A or player B? b Score of Player A: 40 Score of Player B: 40
Who wins a point, player A or player B? a Score of Player A: Adv Score of Player B:
Who wins a point, player A or player B? b Score of Player A: 40 Score of Player B: 40
Who wins a point, player A or player B? b Score of Player A: Score of Player B: Adv
Who wins a point, player A or player B? b
Player B wins the game

Calculate Your Essay Price
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more