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

HI I NEED HELP ON MAKING THE DECK OF CARD FOR A POKER GAME TO WORK I NEED TO CRE

ID: 3672078 • Letter: H

Question

HI I NEED HELP ON MAKING THE DECK OF CARD FOR A POKER GAME TO WORK I NEED TO CREATE A STACK TO MAKE THIS TO WORK WITH A HAND CLASS AND CARD CLASS I ALREADY SUBMIT THIS TWICE AND I DID NOT GET ANY HELPThe Deck class must employ a stack for its underlying structure. Otherwise, your solution should demonstrate reasonable choices of data structures to implement this game. (Most data structures mimic how we do things manually.) Grading will concentrate on this and not on your ability to make it work. You have complete freedom to implement a tester class or use the one provided below for this project, however, keep in mind that your implementations will be tested using another program

public interface DeckInterface

{

Card deal();

boolean isEmpty(); }

public interface HandInterface extends Comparable

{ void addCard(Card card); // Add a card to hand

boolean removeCard(Card card); // Remove this card from hand String

toString(); // Return contents of this hand }

Here what i have so far

import java.util.Stack;
import java.util.*;

public class Deck {
  
public String Deck()
{
  
}
   public interface DeckInterface {
       Stack st = new Stack();
   public String cardDeal();
   {
       Card Shuffle;
       public String cardDeal();
       Shuffle.cardDeal();
   }
      
     

       public boolean card void isEmpty();
       {
  
           if(card.isEmpty());
           {
           return(card==0);
           }
       }
       public String pop();
       {
             
       }
       public
       }
}
  
}

thats all have for the deck of cards class


public class Hand {
   public interface HandInterface extends Comparable<Hand> {
       void addCard(Card card); // Add a card to hand
       boolean removeCard(Card card); // Remove this card from hand
       String toString(); // Return contents of this hand
       }
}

and this for the hand class i already have the tester program

public class Tester {
public static void main(String[] args) {
Deck deck = new Deck();
System.out.println(deck);
  
Hand player1 = new Hand();
Hand player2 = new Hand();
Card card;
Card card1 = null, card3 = null, card4 = null;
for (int i=0; i < 5; i++) {
card = deck.deal();
if (i==1) card1 = card; // card that will be removed
if (i==3) card3 = card; // card that will be removed
player1.addCard(card);
card = deck.deal();
if (i==4) card4 = card; // card that will be removed
player2.addCard(card);
}
System.out.println(player1);
System.out.println(player2);
System.out.println(deck);
// remove 2nd and 4th cards
player1.removeCard(card1);
player1.removeCard(card3);
System.out.println(player1);
player2.removeCard(card4);
System.out.println(player2);
  
player1.addCard(deck.deal()); // Add back
player1.addCard(deck.deal()); // Add back
player2.addCard(deck.deal()); // Add back
System.out.println(deck);
System.out.println(player1);
System.out.println(player2);
int winner = player1.compareTo(player2);
if (winner == 0) {
System.out.println("Tie game");
} else if (winner > 0) {
System.out.println("Player1 wins");
} else {
System.out.println("Player1 lost");
}
}

}

and here is the output of the program

Output will vary due to the random nature of the game. However, sample output might appear as follows: Deck%has%52%cards%remaining [%Queen%of%Diamonds%|%King%of%Hearts%|%Eight%of%Hearts%|%Ace%of%Clubs%|%Two%of%Hearts%] [%Ace%of%Spades%|%Six%of%Diamonds%|%Nine%of%Hearts%|%Nine%of%Spades%|%King%of%Diamonds%] Deck%has%42%cards%remaining [%Queen%of%Diamonds%|%Eight%of%Hearts%|%Two%of%Hearts%] [%Ace%of%Spades%|%Six%of%Diamonds%|%Nine%of%Hearts%|%Nine%of%Spades%] Deck%has%39%cards%remaining [%Queen%of%Diamonds%|%Eight%of%Hearts%|%Two%of%Hearts%|%Eight%of%Clubs%|%Ace%of%Diamonds%] [%Ace%of%Spades%|%Six%of%Diamonds%|%Nine%of%Hearts%|%Nine%of%Spades%|%Four%of%Diamonds%] Player1%wins

im having so much problems with this it should have 52 cards remaining for the top of he deck but i dont know how to accomplish this please help me thank you

Explanation / Answer

/**** Save this code as "Poker.java" and compile with javac. Then run **** with "java Poker" ****/ class Card { int Number; String Suit; public Card(int number, String suit){ Number=number; Suit=suit;} public int getNumber(){ return Number;} public String getSuit(){ return Suit;} public void printName(){ System.out.println(Number + " of " + Suit); } } class Deck { String Suits="CHSD"; /* notused, but should be */ Card cards[]; public Deck(){ int number,cardpos=0; cards=new Card[52]; for(number=1;number