Write a Java Program
Specific Instructions

Create a class for the following object.

Deck - contains 52 cards initially. Each card is represented by an unchangeable suit and value.
Suits - ♣ (Club), ♠ (Spade), ♥ (Heart), ♦ (Diamond)
Values - 1(A),2,3,4,5,6,7,8,9,10,11(J),12(Q),13(K)

Actions

draw - retrieves the top most card on the deck. When called with number of desired cards, it will try to draw the N cards, if not enough, draw all cards.
shuffle - randomizes the location of all cards, excluding the drawn cards
restore - returns the last N cards drawn on the bottom of the deck, if no number is provided, return all drawn cards.
Make sure that the class is encapsulated.

Respuesta :

In the Deck Builder, initialize the 52 cards (along with the 4 jokers, which should be called “wild” and the suit is “wild”).

Public class Deck

   private final List<Carta> Deck;

   public Baralho() {

       listaCartas = new ArrayList<>();

       String[] naipes = {"club", "spade", "heart", "diamond"};

       int pos = 0;

       Carta c;

with this code we will be able to create the Deck, initialize the 52 cards together with the 4 jokers.

Learn more about Deck in https://brainly.com/question/1660537

     

ACCESS MORE