Card class

Update class to include:

1. Method hashCode, it shall
a. Return type int
b. Receive no parameters
c. Include local variable hashCode of data type int initialized to the value of zero
d. Concatenate member variable face and its hashcode
e. Concatenate member variable value and its hashcode
f. Concatenate member variable color and its hashcode
g. Return the local variable hashCode
2. Method equals, it shall
a. Return type boolean
b. Receive one parameter of data type Object
c. Check if the parameter is an instanceof class Card
i. If true
1. Explicitly convert the parameter to an instance of class Card
2. Return the result of comparing if the face, suit, and color match an existing object
3. Code example:
return (card.face.equals(this.face) &&
card.color.equals(this.color) &&
card.suit.equals(this.suit));
ii. Else
1. Return false

Deck class

Update class to

1. Write a custom constructor that
a. Receives no parameters
b. Calls method generateDeck()
c. Calls method displayDeck()
d. Calls method shuffleDeck()
e. Calls method displayDeck()
2. Write method generateDeck so that
a. Return type is void
b. Receives no parameters
c. Instantiates the member variable of type Set calling the constructor for class HashSet
d. Loops through the values of enumeration Face
i. Loops through the values of enumeration Suit
1. Instantiates an instance of class Card
2. Sets the face value of the card
3. Sets the suit of the card
4. Determines the color of the card based on the suit and sets the color of the card
5. Verifies the instance of Card created is not contained in the HashSet of cards
a. If it does not exist, add the instance of class Card to the HashSet
3. Write method displayDeck so that
a. Return type is void
b. Receives no parameters
c. Iterates through the HashSet collection outputting to the console the face value, suit, and color of each card
4. Write method shuffleDeck so that
a. Instantiates an instance of class ArrayList, explicitly for data type of class Card passing the member variable of interface Set as an argument
b. Call static method Collections.shuffle passing the ArrayList from above as an argument
c. Reinstantiate the member variable of interface Set by calling the constructor for class HashSet passing the ArrayList above as an argument

Game class

Update class to

1. Update the custom constructor to call method generateDeck()
2. Add method generateDeck so that
a. Return type is void
b. Receives no parameters
c. Instantiates the member variable of class Deck
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.