Question: Need Help WIth The Hand Class And Driver. Java Program public class DeckOfCards { private Card c1; private Card c2; ... private Card c52; //
Need Help WIth The Hand Class And Driver. Java Program

public class DeckOfCards { private Card c1; private Card c2; ... private Card c52; // 52 Card variables !!! } public class DeckOfCards { public static final int NCARDS = 52; private Card[] deckOfCards; // Contains all 52 cards /* --------------------------------------------------- The constructor method: make 52 cards in a deck --------------------------------------------------- */ public DeckOfCards( ) { /* ================================================================= First: create the array ================================================================= */ deckOfCards = new Card[ NCARDS ]; // Very important !!! // We must crate the array first ! /* ================================================================= Next: initialize all 52 card objects in the newly created array ================================================================= */ int i = 0; for ( int suit = Card.DIAMOND; suit = 10 ) value = 10; else value = this.face; return value; // replace this line with your code } // This method determines whether the front of the card should be visible. public boolean isFaceUp() { return this.faceup; } // This method records that the front of the card should be visible. public void turnFaceUp() { this.faceup = true; } // This method records that only the back of the card should be visible. public void turnFaceDown() { this.faceup = false; } public String toString(){ String cardname = ""; String suitname = ""; if(this.suit == 0) suitname = "Spades"; if(this.suit ==1) suitname = "Hearts"; if(this.suit ==2) suitname = "Clubs"; if(this.suit ==3) suitname = "Diamonds"; if(this.face == 1 || this.face > 10){ String facename = ""; if(this.face == 1) facename = "Ace"; if(this.face == 11) facename = "Jack"; if(this.face == 12) facename = "Queen"; if(this.face == 13) facename = "King"; cardname = facename + " of " + suitname; } else if(this.face != 1 && this.face 1. Define a Class Card that will store the face value of the Card and the Suit Value 1. Include a minimun of 5 fields: o Face Value as Integer o Face Value as String o Suit Value as Integer o Suit Value as String o 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 vou test vour 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 hand 4. Draws a card from the deck and places it in the hand 5. Removes the card from the hand randomly. 6. Removes the card from the hand by position 4. Create a Driver program that tests each of the methods for the deck and for the hand. Get one component working before moving on to the next 1. Print out the deck of cards 2. Print outthe dealt hand. 3. Prints out how many cards are in the deck 4. Prints out how many cards are in the hand. 5. Removes a card from the deck and places it in the hand a. Don't let a card be removed if the deck is empty a. Don't let a card be removed if the hand is empty. a. Don't let a card be removed if the hand is empty. 5. You must use Referenced-based Linked Lists for this progranm 6. Removes a card from the hand by position. f. Removes a card from the hand randomly. 6. You cannot use any built-in Java methods to manipulate your Linked Lists - you must write your own Linked List operations
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
