# Question please solve it in java  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 move 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 $$3-2=1$$, but increased by $$3 \mathrm{X}$$ $$0.5=1.5$$, 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 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.

GA2QLQ The Asker · Computer Science
please solve it in java

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 move 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 $$3-2=1$$, but increased by $$3 \mathrm{X}$$ $$0.5=1.5$$, 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 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 move 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 $$3-2=1$$, but increased by $$3 \mathrm{X}$$ $$0.5=1.5$$, 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 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
FUHRPO

&#12304;General guidance&#12305;The answer provided below has been developed in a clear step by step manner.Step1/2Dear student, here is your self written solution, Do provide UPVOTE!Solution :Here is the require a code in java:public class BasketballShootoutGame { private static final int NUM_ATTEMPTS = 3; // number of attempts per player private static final double TICKET_PER_TIE = 0.5; // half a ticket for every tie private int player1Score; private int player2Score; private int numTies; public BasketballShootoutGame() { this.player1Score = 0; this.player2Score = 0; this.numTies = 0; } public void play() { // player 1 shoots first for (int i = 0; i &lt; NUM_ATTEMPTS; i++) { boolean basketMade = shootBasket(); if (basketMade) { player1Score++; } } // player 2 shoots second for (int i = 0; i &lt; NUM_ATTEMPTS; i++) { boolean basketMade = shootBasket(); if (basketMade) { player2Score++; } } // check winner and update scores if (player1Score &gt; player2Score) { // player 1 wins long numTickets = Math.round(player1Score - player2Score + numTies * TICKET_PER_TIE); System.out.println("Player 1 wins! Owed " + numTickets + " movie ticket(s)."); player1Score = 0; player2Score = 0; numTies = 0; } else if (player2Score &gt; player1Score) { // player 2 wins long numTickets = Math.round(player2Score - player1Score + numTies * TICKET_PER_TIE); System.out.println("Player 2 wins! Owed " + numTickets + " movie ticket(s)."); player1Score = 0; player2Score = 0; numTies = 0; } else { // tie game, increment tie counter numTies++; System.out.println("Tie game!"); } } private boolean shootBasket() { // simulate a random chance of making a basket double probability = 0.5; // 50% chance of making a basket return Math.random() &lt; probability; } public static void main(String[] args) { BasketballShootoutGame game = new BasketballShootoutGame(); int numGames = 3; // play 3 games ... See the full answer