Question: JAVA ::::: Write a program that creates a deck of cards, shuffles it, and deals cards to each of four players. First display a menu,
JAVA :::::
Write a program that creates a deck of cards, shuffles it, and deals cards to each of four players. First display a menu, asking if user wants to shuffle, deal, or end.

package card; //make a deck class and a player classhhh import java.util.Random;
public class main {
public static void main(String args[]){ Card array[][] = new Card[4][13]; Random rand = new Random(); DeckMembers x = new DeckMembers(); for (int i = 0; i
} }
package card;
import java.util.ArrayList; import java.util.Random;
public class DeckMembers extends Card{ private ArrayList deck = new ArrayList();
public void displayDeck(Card[][] array){ for (int i = 0; i
public void shuffleDeck(Random rand){ Card temp; int swap1; for (int i = 0; i
} //Cardobject.compare
//selection sort
public class Card { public int number; public enum Suit {Club, Spade, Diamond, Heart}; Suit suit; public String description; public Card(){ number = -1; }
public Card (int n, Suit s) { number = n; suit = s; setDescription(); }
public void setDescription(){ switch (number) { case 1: description = suit + " Ace"; break; case 11: description = suit + " Jack"; break; case 12: description = suit + " Queen"; break; case 13: description = suit + " King"; break; default: description = Integer.toString(number); description = suit + " " + description; break; } }
public String getDescription (){ return description; }
public void display(){ //System.out.printf("%-15s", description); //the left going deck }
Homework 2-The Deal Write a program that creates a deck of cards, shuffles it, and deals cards to each of four players. First display a menu, asking if user wants to shuffle, deal, or end. After each deal, display cards of each player in sorted order, followed by the location of the Club Two Lady Gagda Albert Einstein Muhammed Ali Diego Maradona Spade Ace Spade 10 Spade 5 Heart King Heart Queen Heart 10 Heart 8 Heart 4 Heart 3 Heart 2 Diamond 7 Qub Jack Qub 8 Spade Jack Spade 8 Spade 4 Spade 3 Heart Ace Heart Jock Heart 9 Diamond Ace Diamond 10 Diamond3 Club 9 Club 7 Club 4 Spade 6 Spade 2 Diamond King Diamond Queen Diamond Jack Diamond 9 Diamond 8 Diamond 6 Diamond 5 Club King Club 10 Club 6 Club 2 Spade King Spade Queen Spade 9 Spade 7 Heart 7 Heart 6 Heart 5 Diamond 4 Diamond 2 Club Ace Club Queen Club 5 Club 3 lub Two - player 3 card 13 Begin with your code from the Deck of Cards Lab. Your program should have three classes, each in a separate file, with these members: Card members suit - enumerated data type for SPADE, HEART, DIAMOND, CLUB number- integer between 1 and 13 description string containing name of card, such as Heart Ace boolean compare(Card card1, Card card2) - returns true if the card1 is less than' card2 false if not, using these rules 1. Regardless of card number, clubs
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
