Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to write, in java, code that does the following: Update the class to do the following: a. Custom constructor Game a. Comment out

I need to write, in java, code that does the following:image text in transcribed

Update the class to do the following: a. Custom constructor Game a. Comment out the call to method outputTeams b. Add call to method play0 b. Update method setTable) to do the following: Using an enhanced for loop output the names of each Player in the member variable table representing the setup of the plavers seated at the table a. c. Update method dealHandO to comment out any System.out.printlno statements that show what card each player is being dealt if they exist Update method displayHands0 to do the following: d. a. Call method sortBySuit for each player b. Only call method displayHandO if the player is an instanceof class HumanPlayer e. Create method play) to do the following: a. Return type of void b. Empty parameter list c. Call method getBids f. Create method getBidsO to do the following: a. Return type of void b. Empty parameter list c. Create a local variable of data type int representing the number of bids placed initialized to the value of zero (0) Create a local variable of data type int to represent the index of the lead player, not initialized Using an if condition, check if the member value of the dealerldx if less than 3 d. e. i. Iftrue then set the lead player index created in step d. equal to the dealerldx plus one ii. Else set the lead player index to zero(0) Set the member variable of class Player representing the leaderPlaver equal to method call getO of the member variable Using an if condition, check if the leaderPlaver member variable is an instanceof class HumanPlayer f. table passing the lead player index as an argument g. i. If true, create an instance of class HumanPlayer set equal to an explicit type cast of the member variable leadPlayer and call method placeBid0 on class HumanPlayer Else, create an instance of class AiPlayer set equal to an explicit type cast of the member variable leadPlayer and call method placeBid0 on class AiPlayer ii. Increment the bids placed counter by one Create a local variable of data type int to represent the current player index, not initialized Using an if condition check if the lead player index is less than 3 h. i. j. i. If true, set the player index equal to the lead player index plus one (1) ii. Instantiate an instance of class Player set equal to the method call get) on member variable table passing as an argument the player index created in step i, to get the nextPlayer While the number of bids submitted is less or equal to the number of players (i.e. 4) Else, set the player index equal to the value of zero (0) k. I. i. Write an if condition to determine if the local variable nextPlayer is an instanceof class HumanPlayer 1. If true, instantiate an instance of class HumanPlayer set equal to an explicit type cast of local variable nextPlayer and call method placeBid0 Else, instantiate an instance of class AiPlayer set equal to an explicit type cast of local variable AiPlaver set equal to an explicit type cast of local variable nextPlayer an call method placeBid0 2. ii. Increment the bids placed counter iii. Write an if condition to check if the value of the local variable for the player index is less than 3 1. If true, increment the player index variable by 2. Else, set the player index variable to zero (O) equal to method call get on member variable table one (1) iv. Set the local variable representing the nextPlaver assing the player index as an argument Update the class to do the following: a. Custom constructor Game a. Comment out the call to method outputTeams b. Add call to method play0 b. Update method setTable) to do the following: Using an enhanced for loop output the names of each Player in the member variable table representing the setup of the plavers seated at the table a. c. Update method dealHandO to comment out any System.out.printlno statements that show what card each player is being dealt if they exist Update method displayHands0 to do the following: d. a. Call method sortBySuit for each player b. Only call method displayHandO if the player is an instanceof class HumanPlayer e. Create method play) to do the following: a. Return type of void b. Empty parameter list c. Call method getBids f. Create method getBidsO to do the following: a. Return type of void b. Empty parameter list c. Create a local variable of data type int representing the number of bids placed initialized to the value of zero (0) Create a local variable of data type int to represent the index of the lead player, not initialized Using an if condition, check if the member value of the dealerldx if less than 3 d. e. i. Iftrue then set the lead player index created in step d. equal to the dealerldx plus one ii. Else set the lead player index to zero(0) Set the member variable of class Player representing the leaderPlaver equal to method call getO of the member variable Using an if condition, check if the leaderPlaver member variable is an instanceof class HumanPlayer f. table passing the lead player index as an argument g. i. If true, create an instance of class HumanPlayer set equal to an explicit type cast of the member variable leadPlayer and call method placeBid0 on class HumanPlayer Else, create an instance of class AiPlayer set equal to an explicit type cast of the member variable leadPlayer and call method placeBid0 on class AiPlayer ii. Increment the bids placed counter by one Create a local variable of data type int to represent the current player index, not initialized Using an if condition check if the lead player index is less than 3 h. i. j. i. If true, set the player index equal to the lead player index plus one (1) ii. Instantiate an instance of class Player set equal to the method call get) on member variable table passing as an argument the player index created in step i, to get the nextPlayer While the number of bids submitted is less or equal to the number of players (i.e. 4) Else, set the player index equal to the value of zero (0) k. I. i. Write an if condition to determine if the local variable nextPlayer is an instanceof class HumanPlayer 1. If true, instantiate an instance of class HumanPlayer set equal to an explicit type cast of local variable nextPlayer and call method placeBid0 Else, instantiate an instance of class AiPlayer set equal to an explicit type cast of local variable AiPlaver set equal to an explicit type cast of local variable nextPlayer an call method placeBid0 2. ii. Increment the bids placed counter iii. Write an if condition to check if the value of the local variable for the player index is less than 3 1. If true, increment the player index variable by 2. Else, set the player index variable to zero (O) equal to method call get on member variable table one (1) iv. Set the local variable representing the nextPlaver assing the player index as an argument

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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