Poker Application
- Each student is to add to
their Player class the following methods (each count
as 5 points per correct method). Note: the pair() method should
return true even if the player has a three-of-a-kind or a four-of-a-kind.
In other words, each method is "independant" of the other methods.
- private boolean royalFlush()
- private boolean
fourOfKind()
- private boolean straightFlush()
- private boolean straight()
- private boolean flush()
- private boolean fullHouse()
- private boolean
threeOfKind()
- private boolean twoPair()
- private boolean pair()
- private boolean highCard()
- Each student is to add to their Player class the following method.
The purpose of this method is to call the above methods in order
to return the String that describes the "best" poker hand that
the player possesses. It is to be used by the Poker game as described
below.
- public String getHandType()
- Each student is to create a copy of their TenCard
game called Poker.java and make the following modifications:
- Keep
the 10 buttons on the screen (5 in first row, 5 in
second row) that do everything that the TenCard.java did (i.e.
clicking
on the
button gets a new card from the deck & puts a new image
on the button)
- One button called "Deal" which, when clicked,
will
- deal 5 cards to each player.
- ask each player what type of hand they have (displaying
the answer in a textfield below)
- take the 5 cards out of the players hand and display
the cards on the screen (i.e. on the buttons)
- Three text fields:
a) One textfield which shows Player1's hand type (i.e. "Player 1 has a
three of kind");
b) One textfield which shows Player2's hand type (i.e. "Player 2 has two
pair");
c) One textfield which shows which player had the better hand (i.e. "Player
1 wins"); [bonus]
- Comment each method correctly.
- Be prepared to show
your instructor your working program.
|