Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, please use top-down design method (java) and please solve it ASAP. Thank You Overview In this assignment you will design, write and test a

image text in transcribedimage text in transcribed

Hi, please use top-down design method (java) and please solve it ASAP.

Thank You

image text in transcribed
image text in transcribed
Overview In this assignment you will design, write and test a complete Java program which keeps score for a tennis match. The program will get input from the user which includes the two players last names (.e. Borg and McEnroe). The number of sets the match is out of 3 or 5), and the starting bias value (see below). The program will then use random binary values (0 or 1) to determine which player won each point that is played, where the random values will be blased towards one player or the other. Note that the bias value will constantly shift between the two players throughout the match, as one player gains momentum in the match Assignment Task 1. Write a complete Java program that is broken down into the main method of course and private atasie metode. The program should start by getting some input from the user where the input values are validated as shown below String - Player A name "Evert' or 'Chris Evert") String- Payer name (le Graf or "Stem Grar) 10-> Number of sets to be played maximum (must either be set to 3 or 5) Los Starting blas value to use must be a value from 0.100) where would be set to 50 ir ne two players were evenly matched Make a decision on how you can practically handle the station vid inputs are given for the number of sets or the starting blas value. Which of these inputs can be used for testing your program? What kind of tests can you plan to do for when your program is thised? 2. Plan, design and write the program where Individual tasks which are done repeatedly (or more than once are made into separate methods. Please note that the sandages method that was wen in the cass exercise can be reused for this assignment. If you are unfamiliar with how a tennis maton is scored then you will need to work through how it all works before you start programming. Your program should keep track of the score after each point is played print out the game score after each point and display which player wins each game set and the match your program does not need to keep track of who is serving (which is relevant, only who wins each point matters here), or calling out the score where the server's name goes frst Just use Player A (represented by D's in the data which always goes first and Player (represented by 1) when printing calling the score. There are two modifications to actual real tennis scoring that need to be changed to simpilty your program. The first show the score is called out after a point has been played at deuce score isted at 40-40). Normally, if the server won the point then the score would be Ad in (with "Ad Our meaning the returner won the point at deuce). In your program, the score can instead include the player who wins the point at deuce (so you can use "Ad Player A" or "Ad Player 5. or you can insert the player's name for the A/5). The second change will go back in time before the modern tebreaker was invented. In other words, your program does not need to include atlebreaker (which has its own, completely different scoring system. Instead, as we are not keeping track of who is serving, if a set sted at 6-6 then whoever wins the next game wins the set 7-6 Score, unul the . . s Example - Your program should indicate who won each point match is complete. For example, if Player Ais "Borg" and Player B is McEnroe, and the basis set to start at (which means that Borg would win every point), then the score would be displayed as follows Start of play - Borg vs McEnroe - best out of 5 sets Point Borg, Game Score: 15 - Love Point Borg, Game Score: 30 - Love Point Borg, Game Score: 40 - Love Point Borg, Game Borg Set Score: 1 - 0 ....and so on until the first set is finished... Point Borg, Game Borg Set Borg: 6-O Example - If the bias was instead set to 50 (meaning there is a 50-80% chance that either player wins each point) and the random binary digits generated are [0110101011] meaning it took 10 points to complete the first game, then the score displayed would be Start of play - Borg vs McEnzoe - best out of 5 sets Point Borg, Game Score: 15 - Love Point McEnroe, Game Score: 15 - 15 Point McEnroe, Game Score: 15 - 30 Point Borg, Game Score: 30 - 30 Point McEnroe, Game Score: 30 - 40 Point Borg, Gare Score: Deuce Point MeEnroe, Game Score: Ad McEnroe Point Borg, Game Score: Deuce Point McEnroe, Game Score: Ad McEnroe Point McEnroe, Game McEnroe Set Score: 0 - 1 . ... and so on until the first set is finished... . . . . Point Me Enroe, Game McEnroe Bet McEnroe: 3 - 6 4. Update/Add to your program so that the bias value starts with the value provided as input, but changes after each point is played. If the random binary digit comes out to be then Player A won the point and the bias value can be decreased by 1. If the random binary digit comes out to be 1 then Player 3 won the point and the bias value can be increased by 1. Furthermore, winning a game changes the bias value by 2 in that player's favour, and winning a set changes the bias value by 5. In the second example above, the bias value was said to have started at 50. After the first game has been completed, what would the bias value be set to before the first point of the second game? Which player would be favoured at this point in the match? Overview In this assignment you will design, write and test a complete Java program which keeps score for a tennis match. The program will get input from the user which includes the two players last names (i.e. Borg and McEnroe), the number of sets the match is out of (3 or 5), and the starting bias value (see below). The program will then use random binary values (0 or 1) to determine which player won each point that is played, where the random values will be biased towards one player or the other. Note that the bias value will constantly shift between the two players throughout the match, as one player gains momentum in the match Assignment Tasks 1. Write a complete Java program that is broken down into the main method (of course) and private static methods. The program should start by getting some input from the user where the input values are validated as shown below. String -> Player A name (.e. "Evert" or "Chris Evert") String -> Player B name (i.e. "Graf or "Steffi Graf) int-> Number of sets to be played maximum (must either be set to 3 of 5) int-> Starting bias value to use (must be a value from 0... 100) where it would be set to 50 if the two players were evenly matched Make a decision on how you can practically handle the situation i invalid inputs are given for the number of sets or the starting bias value. Which of these inputs can be used for testing your program? What kind of tests can you plan to do for when your program is finished? 2. Plan, design and write the program where individual tasks which are done repeatedly (or more than once) are made into separate methods. Please note that the randomDigit method that was written in the class exercise can be reused for this assignment. If you are unfamiliar with how a tennis match is scored then you will need to work through how it all works before you start programming. Your program should keep track of the score after each point is played print out the game score after each point, and display which player wins each game, set and the match. Your program does not need to keep track of who is serving (which is irrelevant only who wins each point matters here), or calling out the score where the server's name goes first. Just use Player A (represented by O's in the data) which always goes first and Player 3 (represented by 1's) when printing/calling the score. There are two modifications to actual real tennis scoring that need to be changed to simplify your program. The first is how the score is called out after a point has been played at deuce (score is tied at 40-40). Normally, if the server won the point then the score would be "Ad in" (with "Ad Out" meaning the returner won the point at deuce). In your program, the score can instead include the player who wins the point at deuce (so you can use "Ad Player A or "Ad Player B", or you can insert the player's name for the A/B). The second change will go back in time before the modern tiebreaker was invented. In other words, your program does not need to include a tiebreaker (which has its own, completely different scoring system). Instead, as we are not keeping track of who is serving, if a set is tied at 6-6 then whoever wins the next game wins the set 7-6. 3. Example - Your program should indicate who won each point and print out the score, until the match is complete. For example, if Player Ais "Borg' and Player Bis McEnroe, and the bias is set to start at o (which means that Borg would win every point), then the score would be displayed as follows: start of play - Borg vs McEnroe - best out of 5 sets Point Borg, Game Score: 15 - Love Point Borg, Game Score: 30 - Love Point Borg, Game Score: 40 - Love Point Borg, Game Borg Set Score: 1 - 0 ...and so on until the first set is finished... Point Borg, Game Borg Set Borg: 6-0 Example - If the bias was instead set to 50 (meaning there is a 50-50% chance that either player wins each point) and the random binary digits generated are 0110101011] meaning it took 10 points to complete the first game, then the score displayed would be: Start of play - Borg vs McEnroe - best out of 5 sets Point Borg, Game Score: 15 - Love Point McEnroe, Game Score: 15 - 15 Point McEnroe, Game Score: 15 - 30 Point Borg, Game Score: 30 - 30 Point McEnroe, Game Score: 30 - 40 Point Borg, Game Score: Deuce Point McEnroe, Game Score: Ad McEnroe Point Borg. Game Score: Deuce Point McEnroe, Game Score: Ad McEnroe Point McEnroe, Game McEnroe Set Score: 0-1 ... and so on until the first set is finished... Point McEnroe, Game McEnroe Set McEnroe: 3 - 6 4. Update/Add to your program so that the bias value starts with the value provided as input, but changes after each point is played. If the random binary digit comes out to be then Player A won the point and the bias value can be decreased by 1. If the random binary digit comes out to be 1 then Player B won the point and the bias value can be increased by 1. Furthermore, winning a game changes the bias value by 2 in that player's favour, and winning a set changes the bias value by 5. In the second example above, the bias value was said to have started at 50. After the first game has been completed, what would the bias value be set to before the first point of the second game? Which player would be favoured at this point in the match

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is quality of work life ?

Answered: 1 week ago

Question

What is meant by Career Planning and development ?

Answered: 1 week ago

Question

What are Fringe Benefits ? List out some.

Answered: 1 week ago

Question

define what is meant by the term human resource management

Answered: 1 week ago