Project #5069 - Java Program

Using the provided PlayingCard class, I'm attempting to write code that simulates a game that deals 5 cards to two players. The game will be scored using basic poker hands and a winner will be determined from the initial 5 card draw. Continue playing multiple games by asking the user if they wish to play again. If they do not wish to play again, exit the game. For each game, display what suit and values each of the 5 cards are for each player and indicate the winner and what hand they have. Utilize arrays to store your hands and utilize the enums provided to indicate suits and values.

Here is the provided code:

import java.util.Random;

public class PlayingCard
{
public static enum Suit { HEART, DIAMOND, CLUB, SPADE }

public static enum Value {TWO, THREE, FOUR, FIVE, SIX, SEVEN,
EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE }

private Suit cardSuit;
private Value cardValue;



public PlayingCard()
{
cardSuit = Suit.SPADE;
cardValue = Value.ACE;
}

public PlayingCard(Suit s, Value v)
{
cardSuit = s;
cardValue = v;
}

public Suit getSuit()
{
return cardSuit;
}

public Value getValue()
{
return cardValue;
}

public void SetCard(Suit s, Value v)
{
cardSuit = s;
cardValue = v;
}

public static PlayingCard getRandomPlayingCard()
{
PlayingCard returnCard = new PlayingCard();
Random random = new Random();
returnCard.SetCard(Suit.values()[random.nextInt(Suit.values().length)],
Value.values()[random.nextInt(Value.values().length)]);
return returnCard;
}
}

Subject Computer
Due By (Pacific Time) 04/26/2013 11:40 pm
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy