Question
Card class Update class to include: Method hashCode, it shall Return type int Receive no parameters Include local variable hashCode of data type int initialized
Card class | Update class to include: Method hashCode, it shallReturn type int Receive no parameters Include local variable hashCode of data type int initialized to the value of zero Return the local variable hashCode Method equals, it shallReturn type Boolean Receive one parameter of data type Object Check if the parameter is an instanceof class CardIf trueExplicitly convert the parameter to an instance of class Card Return the result of comparing if the face, suit, and color match an existing object Code example: return (card.face.equals(this.face) && card.color.equals(this.color) && card.suit.equals(this.suit)); ElseReturn false
|
Deck class | Update class to Write a customer constructor thatReceives no parameters Calls method generateDeck() Calls method displayDeck() Calls method shuffleDeck() Calls method displayDeck() Write method generateDeck so thatReturn type is void Receives no parameters Instantiates the member variable of type Set calling the constructor for class HashSet Loops through the values of enumeration FaceLoops through the values of enumeration SuitInstantiates an instance of class Card Sets the face value of the card Sets the suit of the card Determines the color of the card based on the suit and sets the color of the card Verifies the instance of Card created is not contained in the HashSet of cardsIf it does not exist, add the instance of class Card to the HashSet Write method displayDeck so thatReturn type is void Receives no parameters Iterates through the HashSet collection outputting to the console the face value, suit, and color of each card Write method shuffleDeck so thatInstantiates an instance of class ArrayList, explicitly for data type of class Card passing the member variable of interface Set as an argument Call static method Collections.shuffle passing the ArrayList from abouve as an argument 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 Update the custom constructor to call method generateDeck() Add method generateDeck so thatReturn type is void Receives no parameters Instantiates the member variable of class Deck
|
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started