Question Computational thinking for a software developer/computer programmer is a critical skill that is consistently applied. This lab requires you to develop a solution using Java object-oriented programming that simulates a basketball shootout game. Two players agree to limit the number of ball throw attempts to 3 throws each. The first player will make all three Computational thinking for a software developer/computer programmer is a critical skill that is consistently applied. This lab requires you to develop a solution using Java object-oriented programming that simulates a basketball shootout game. Two players agree to limit the number of ball throw attempts to 3 throws each. The first player will make all three throw attempts (keep track of the successful baskets made where the ball goes into the basket). After the first player completes all three shots, the second player will make all three throw attempts. The player who makes the most baskets (gets the ball in the hoop) will be declared the winner. In the case of a tie, the tie counter is incremented by one. Then, the game is repeated until a winner can be determined. Note that the game can be repeated many times. The losing player of the shootout game will have to give the winning player a movie ticket(s). The number of movie tickets is determined by the total number of baskets made by the winner, less the total number of baskets made by the losing player. The losing player gives half of a movie ticket for every tied game (if there were any tied games). If the final calculated number of movie tickets has a decimal value, it should be rounded to the nearest whole number since you can't purchase half a ticket! Example: If the player-1 made a total of 3 baskets, and player-2 made a total of 2 , and they had three tied games, the number of movie tickets would initially be <span class="katex-display fleqn"><span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.7278em;vertical-align:-0.0833em;"></span><span class="mord"><span class="mord mathbf">3</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord mathbf">2</span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord mathbf">1</span></span></span></span></span>, but increased by <span class="katex-display fleqn"><span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6861em;"></span><span class="mord mathbf">3X</span><span class="mord"><span class="mord mathbf">0.5</span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord"><span class="mord mathbf">1.5</span></span></span></span></span></span>, making the owed number of tickets 2.5 which must be rounded up to 3 movie tickets. In this lab, you need to write Java code to implement the Game.java class described by the given Java 3 API inside the doc folder where the documentation for this lab is stored. You'll see there is a file called index.html. Clicking on this file shows the lab/project documentation in your browser. You do not have to include JavaDoc comments.

X9LPXC The Asker · Computer Science

Use this code:

​​​​​​​

Transcribed Image Text: Computational thinking for a software developer/computer programmer is a critical skill that is consistently applied. This lab requires you to develop a solution using Java object-oriented programming that simulates a basketball shootout game. Two players agree to limit the number of ball throw attempts to 3 throws each. The first player will make all three throw attempts (keep track of the successful baskets made where the ball goes into the basket). After the first player completes all three shots, the second player will make all three throw attempts. The player who makes the most baskets (gets the ball in the hoop) will be declared the winner. In the case of a tie, the tie counter is incremented by one. Then, the game is repeated until a winner can be determined. Note that the game can be repeated many times. The losing player of the shootout game will have to give the winning player a movie ticket(s). The number of movie tickets is determined by the total number of baskets made by the winner, less the total number of baskets made by the losing player. The losing player gives half of a movie ticket for every tied game (if there were any tied games). If the final calculated number of movie tickets has a decimal value, it should be rounded to the nearest whole number since you can't purchase half a ticket! Example: If the player-1 made a total of 3 baskets, and player-2 made a total of 2 , and they had three tied games, the number of movie tickets would initially be , but increased by , making the owed number of tickets 2.5 which must be rounded up to 3 movie tickets. In this lab, you need to write Java code to implement the Game.java class described by the given Java 3 API inside the doc folder where the documentation for this lab is stored. You'll see there is a file called index.html. Clicking on this file shows the lab/project documentation in your browser. You do not have to include JavaDoc comments.
More
Transcribed Image Text: Computational thinking for a software developer/computer programmer is a critical skill that is consistently applied. This lab requires you to develop a solution using Java object-oriented programming that simulates a basketball shootout game. Two players agree to limit the number of ball throw attempts to 3 throws each. The first player will make all three throw attempts (keep track of the successful baskets made where the ball goes into the basket). After the first player completes all three shots, the second player will make all three throw attempts. The player who makes the most baskets (gets the ball in the hoop) will be declared the winner. In the case of a tie, the tie counter is incremented by one. Then, the game is repeated until a winner can be determined. Note that the game can be repeated many times. The losing player of the shootout game will have to give the winning player a movie ticket(s). The number of movie tickets is determined by the total number of baskets made by the winner, less the total number of baskets made by the losing player. The losing player gives half of a movie ticket for every tied game (if there were any tied games). If the final calculated number of movie tickets has a decimal value, it should be rounded to the nearest whole number since you can't purchase half a ticket! Example: If the player-1 made a total of 3 baskets, and player-2 made a total of 2 , and they had three tied games, the number of movie tickets would initially be , but increased by , making the owed number of tickets 2.5 which must be rounded up to 3 movie tickets. In this lab, you need to write Java code to implement the Game.java class described by the given Java 3 API inside the doc folder where the documentation for this lab is stored. You'll see there is a file called index.html. Clicking on this file shows the lab/project documentation in your browser. You do not have to include JavaDoc comments.
Community Answer
X71VK3

&#12304;General guidance&#12305;The answer provided below has been developed in a clear step by step manner.Step1/3logical framework and algorithm used to construct the game in Java.1.Make a class called "Game" with the following characteristics: Players two objects An integer that counts the number of games that have been tied An integer to record the total amount of movie tickets that the losing player is required to pay.2.Create a play() function for the Game class that mimics a basketball shootout: Up until each player has made three shots, each player takes turns shooting the ball. Please update the player's score after each shot (i.e., the number of successful baskets made) With the scores, decide who will win the game. Increase the tie counter if the game is still tied. Based on the difference between the winner's score and the loser's score, as well as the number of tied games, determine how many movie tickets the losing player owes.3.Make a class called "Player" with the following characteristics: A name A number that serves as the player's score counter a boolean to show whether the player has the opportunity to shoot4.In the Player class, create a shoot() method that simulates a player shooting the ball: Generate a random number between 0 and 1 to determine if the shot is successful If the shot is successful, increment the player's score In the main() method, create a Game object and call the play() method to start the game. Repeat the game until a winner is determined.Explanation:Please refer to solution in this step.Step2/3Here's a sample implementation of the Game and Player classesimport java.util.Random;public class Game { private Player player1; private Player player2; private int numTies; private int numTickets; public Game(Player player1, Player player2) { this.player1 = player1; this.player2 = player2; this.numTies = 0; this.numTickets = 0; } public void play() { player1.setTurn(true); player2.setTurn(false); while (player1.getNumShots() &lt; 3 || player2.getNumShots() &lt; 3) { if (player1.getTurn()) { player1.shoot(); if (player1.getNumShots() == 3) { player1.setTurn(false); player2.setTurn(true); } } else { player2.shoot(); if (player2.getNumShots() == 3) { player1.setTurn(true); player2.setTurn(false); } } } int player1Score = player1.getScore(); int player2Score = player2.getScore(); if (player1Score &gt; player2Score) { numTickets += player1Score - player2Score; } else if (player1Score &lt; player2Score) { numTickets += player2Score - player1Score; } else { numTies++; } } public int getNumTies() { return numTies; } public int getNumTickets() { return numTickets; }}public class Player { private String name; private int score; private int numShots; private boolean turn; public Player(String name) { this.name = name; this.score = 0; this.numShots = 0; this.turn = false; } public void shoot() { ... See the full answer