Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

GUTS! THE PACK A Standard 52 card deck is used. THE DEAL Each player is dealt 2 cards; face down, starting with the player to

GUTS!

THE PACK

A Standard 52 card deck is used.

THE DEAL

Each player is dealt 2 cards; face down, starting with the player to the left of the dealer.

THE PLAY

Each round starts with an ante. Starting with the player to dealer's left and continuing clockwise around the table, ending with the dealer, each player in turn says either "in" or "out."

Players who say "out" cannot win the pot, but do not lose any extra money. If more than one player says "in," all those who are "in" show their cards, and the player with the best cards wins the pot.

SCORING:

- Aces are high - Any pair of equal cards beats any two unequal cards - A higher pair beats a lower pair - Between two non-pair hands, the hand with the highest card wins - If two hands have equal high cards, the hand whose other card is higher wins.

Coded in Java! already have a DeckOfCards and Card classes set up (will provide below) would like to have one more blueprint if possible (preferably something like Hand)

Driver class will be GUTS.

----------------------------------------DeckOfCards--------------------------------------------------------------------

public class DeckOfCards

{

private static final String[] faces =

{"Ace", "Deuce", "Three", "Four", "Five", "Six",

"Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"};

private static final String[] suits =

{"Hearts", "Diamonds", "Clubs", "Spades"};

private static final int NUMBER_OF_CARDS = 52; // constant number of cards

private ArrayList deck= new ArrayList(); // array of Card objects

// constructor fills deck of cards

public DeckOfCards()

{

// populate deck with Card objects

for (int count = 0; count < 52; count++)

deck.add( new Card(count%13+1, faces[count % 13], suits[count / 13]));

}

public String toString() {

String ans = "";

for (int i=0;i

ans = ans +deck.get(i).toString() + " ";

return ans;

}

// shuffle deck of cards with one-pass algorithm

public void shuffle()

{

Collections.shuffle(deck);

}

}

---------------------------Card--------------------------------------------------------------------------------

public class Card {

private String face; // face of card

private String suit; // suit of card

private int value; // 1 to 13 for value

// constructor

public Card(int num,String cardFace, String cardSuit) {

face = cardFace; // initialize face of card

suit = cardSuit; // initialize suit of card

value = num;

}

// return String representation of Card

public String toString() {

return value + ":" + face + " of " + suit;

}

public String getFace() {

return face;

}

public void setFace(String face) {

this.face = face;

}

public String getSuit() {

return suit;

}

public void setSuit(String suit) {

this.suit = suit;

}

public int getValue() {

return value;

}

public void setValue(int value) {

this.value = value;

}

} // end class Card

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions