Constants class

Add the following constants

1. int ONE = 0
2. int TWO = 1
3. int NUM_PLAYERS = 4
4. int DEAL_ONE = 2
5. int DEAL_TWO = 3

Deck class

Update class to

1. If not already included, generate getter/setter for member variable of data type Set< Card> that represents the deck of cards for the game

Game class

Update class to
1. Add member variables
a. Modify member variable named trump to be of data type class Card instead of enumeration Suit
b. Add member variable of data type class ArrayList specifically to only allow for instances of class Player that represents the game table layout (i.e. players of the game Euchre are set up so that team members sit across from each other, therefore the deal would be similar to TeamOne.PlayerOne, TeamTwo.PlayerOne, TeamOne.PlayerTwo, TeamTwo.PlayerTwo depending upon who the dealer is)
c. Add member variable of data type int to represent an integer index of the current dealer based on the table layout
d. Add member variable of data type int to represent an integer index of the lead player based on the table layout
2. Update custom constructor to call methods AFTER existing method calls
a. setTable
b. dealHand
c. displayHands
3. Write method setTable to do the following:
a. Return type void
b. Empty parameter list
c. Instantiate the member variable that represents the player table that is of data type ArrayList
d. Instantiate two instances of class Team set equal to each instance of class Team stored in the member variable of data type class ArrayList specifically of data type class Team
e. Instantiate four instances of class Player set equal to each instance of class Player stored in the member variable in class Team of data type class ArrayList of data type class Player
(i.e. players of the game Euchre are set up so that team members sit across from each other, therefore the deal would be similar to TeamOne.PlayerOne, TeamTwo.PlayerTwo, TeamOne.PlayerTwo, TeamTwo.PlayerTwo depending upon who the dealer is)
i. There should be an instance of class Player that represents TeamOne, PlayerOne
ii. There should be an instance of class Player that represents TeamOne, PlayerTwo
iii. There should be an instance of class Player that represents TeamTwo, PlayerOne
iv. There should be an instance of class Player that represents TeamTwo, PlayerTwo
f. Explicitly add each player to the member variable that represents the game table, from above in an alternating pattern so that a player from TeamOne is added, followed by a player from TeamTwo, followed by a player from TeamOne, followed by a player from TeamTwo; this requires using the method signature of class ArrayList.add that requires two arguments; the first argument is the position in the ArrayList (i.e. 0, 1, 2, 3), the second argument is the object of data type class Player (e.g. table.add(0, teamOnePlayerOne)
4. Write method setDealerAndLead to do the following
a. Instantiate an instance of class Random
b. Set the member variable of primitive data type int that will represent a random integer of four players to determine who the initial dealer of the game is set equal to the method call .nextInt passing as an argument the value of the number of players in the game (i.e. four)
c. Set the member variable that represents the current dealer equal to the randomly selected value from item f. above using the .get method in class ArrayList on the member variable that represents the Euchre table
5. Write method dealHand to do the following
a. Return type void
b. Empty parameter list
c. Call method setDealerAndLead
d. Create a local variable of data type int to represent the current player index initialized to the leadIdx member variable
e. Create a local variable of data type class Iterator explicitly only allowing for members of class Card set equal to member variable deck, calling method getDeck followed by method getIterator
f. For the first deal of two cards each, loop through the number of players
i. Call method dealOne passing as arguments the variables player index and the iterator
ii. If the current player value is greater than 3, reset the variable to the value of 0; otherwise increment the current player
g. For the second deal of three cards each, loop through the number of players
i. Call method dealTwo passing as arguments the variables player index and the iterator
ii. If the current player value is greater than 3, reset the variable to the value of 0; otherwise increment the current player
h. Set the member variable trump equal to the next card on the deck
6. Write method dealOne so it does the following
a. Return type void
b. Receives two parameters
i. Data type int representing the current player index
ii. Data type Iterator< Card> representing the iterator
c. Loops twice
i. Checks if the iterator has a next Card
1. Instantiate an instance of class Card set equal to method call next on the parameter iterator
2. Outputs to the console the dealt card and the player it was dealt to
3. Adds the card to the player’s hand by calling method getHand followed by method add, on the player instance stored at the parameter index location of member variable table
ii. Remove the current card from the HashSet using method call remove
7. Write method dealTwo so it does the following
a. Return type void
b. Receives two parameters
i. Data type int representing the current player index
ii. Data type Iterator< Card> representing the iterator
c. Loops thrice
i. Checks if the iterator has a next Card
1. Instantiate an instance of class Card set equal to method call next on the parameter iterator
2. Outputs to the console the dealt card and the player it was dealt to
3. Adds the card to the player’s hand by calling method getHand followed by method add, on the player instance stored at the parameter index location of member variable table
ii. Remove the current card from the HashSet using method call remove
8. Write method displayHands to do the following
a. Loops through the game teams
i. Call method outputHands in class Team

Player class

Update class to

1. Add member variable of data type class ArrayList specifically only allowing for instances of class Card that represents the player’s hand
2. Generate getter/setter for the member variable above representing the player’s hand
3. Write a customer constructor that
a. Receives no parameters
b. Instantiates the member variable of type ArrayList representing the player’s hand
4. Write method displayHand
a. Return type void
b. Empty parameter list
c. Using an enhanced for loop, loop through the hand of the player
i. Output to the console the face and suit of each card in the player's hand

Team class

Update class to

1. If it isn’t already included, add member variable of data type class String to represent the team’s name
2. Generate getter/setter for member variable representing the team’s name
3. Write method outputHands
a. Return type void
b. Empty parameter list
c. Using an enhanced for loop, loop through the collection of class Team
i. Call method outputHands for each player
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.