JAVA Program Please Help Me Define a Class Card that will store the face value o
ID: 3685279 • Letter: J
Question
JAVA Program
Please Help Me
Define a Class Card that will store the face value of the Card and the Suit Value 1. 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) 2. Include a method to return the value of both for printing. I suggest you use toString(). 2. Create a class for the Deck of Cards containing a set of operations that do the following: 1. Initializes a Linked List that contains all 52 cards in order. 2. Draws one card at a time from the Deck and removes the card from the deck. 3. Checks to see if there are any cards in the deck. 4. Keeps track of how many cards are left in the deck. 5. Shuffles the deck. 6. Print the deck for debugging purposes as you test your game. 3. Create a class for a dealt hand of cards containing a set of operations that do the following: 1. Initializes an empty hand of cards. 2. Prints the hand of cards. 3. Keeps track of how many cards are in the hExplanation / Answer
1....
public class Card {
public String Face []={null ,"Ace", "Deuce", "Three", "Four","Five",
"Six","Seven","Eight","Nine","Ten","Jack","Queen","King"};
public String Suit [] = {null,"Heart", "Spade", "Diamonds", "Clubs", "Spaids"};
public int n = 0;
public int k = 0;
public Card(int suit, int face){
this.n = suit;
this.k = face;
}
public String getSuit(){
String cardSuit = Suit[n];
return(cardSuit);
}
public String getFace(){
String cardFace = Face[k];
return(cardFace);
}
public String toString(){
String result;
result = getFace() + " of " + getSuit();
return(result);
}
public static void main(String[] args) {
Card c = new Card(1,2);
System.out.println(c);
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.