Create a card class that has the following class variables f
Create a card class that has the following class variables; face (club, diamond, heart, and spade), colour (red or black), value (assume ace is 1, jack 11, queen 12, king 13 and the rest are face value), and face up state (a boolean that is true if the card is face up). also create a ToString method that returns the contents of all the variables
Create a deck class that has the following class variables; an arraylist of cards, the total number of cards in the deck. create the following methods; shuffle that swaps each card with a randomly chosen other card in the deck, AddCard accepts a card object and optional position to add it to in the deck (default is the bottom of the deck), RemoveCardaccepts a position to remove a card from the deck, GetCard accepts a position in the deck (default is the top of the deck) and returns info about the card at that position.
Create a driver class that creates a dealer deck with all 52 cards and 5 empty decks for 5players. deal 8 random cards to each player’s deck from the dealer’s deck, add up and display the value of each player’s deck, each player then passes 2 random cards from their deck to the next player (1->2->3->4->5->1). Add up and display the value of each player’s deck again.
The player with the highest deck value places a random card on the table (anotherarraylist), following the player sequence above each player places the lowest card they have that is higher than the last placed card on the table. Keep cycling through the players, if a player doesn’t have a card they can place they are eliminated continue until there is only 1 player remaining.
In Java, Please!!!
Solution
/** * * @file:Card.java * @author * @date:Created on Jan 23, 2017 * */ public class Card { public String face; public String colur; public int value; public boolean state=false; @Override public String toString() { return \"Card{\" + \"face=\" + face + \", colur=\" + colur + \", value=\" + value + \", state=\" + state + \'}\'; } /** * * @param face * @param colur * @param value */ public Card(String face, String colur, int value) { this.face = face; this.colur = colur; this.value = value; } } /** * * @file:Deck.java * @author * @date:Created on Jan 23, 2017 * */ import java.util.ArrayList; import java.util.Collections; public class Deck { public ArrayList