Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JAVA Please Help Define a Class Card that will store the face value of the Card

ID: 3683471 • Letter: J

Question

JAVA Please Help

Define a Class Card that will store the face value of the Card and the Suit Value Include a minimun of 5 fields: Face Value as Integer Face Value as String Suit Value as Integer Suit Value as String Card number of 1 to 52 (or 0 to 51) Include a method to return the value of both for printing. I suggest you use to String(). Create a class for the Deck of Cards containing a set of operations that do the following: Initializes a Linked List that contains all 52 cards in order. Draws one card at a time from the Deck and removes the card from the deck. Checks to see if there are any cards in the deck. Keeps track of how many cards are left in the deck. Shuffles the deck. Print the deck for debugging purposes as you test your game. Create a class for a dealt hand of cards containing a set of operations that do the following: Initializes an empty hand of cards. Prints the hand of cards. Keeps track of how many cards are in the hand. Draws a card from the deck and p

Explanation / Answer

public class Card

{

public final static int SPADES = 0;   

public final static int HEARTS = 1;
public final static int JOKER = 2;

private final int suit;

private final int value;

public Card() {
suit = JOKER;
value = 1;
}

public String toString()

{

if (suit == JOKER)

{

if (value == 1)

return "Joker";
else
return "Joker #" + value;
}
else
return getValueAsString() + " of " + getSuitAsString();
}
}