Question
*IN JAVA PLEASE* Description For this assignment you are going to design a game of Blackjack. Blackjack is a popular card game in casinos. In
*IN JAVA PLEASE*
Description
For this assignment you are going to design a game of Blackjack. Blackjack is a popular card game in casinos. In this lab, you will simulate the game using simplified rules (no double-down, insurance, or splitting pairs).
Simplified Rules
Both the player and the dealer are given two cards. The dealer's second card is dealt face up, so all the players may see it. If the dealer has a blackjack (that is, her two cards are an ace and a face card), then all the players immediately lose or push if they too have a blackjack. The object of the game is to accumulate two or more cards with a point total as close to 21 as possible, without going over 21. Face cards (Jacks, Queens, and Kings) are all worth ten points each. Aces are worth either one or eleven. Each player, in turn, may request a card, stopping when they are satisfied with their total or when they "bust," or their total is greater than 21. After the players have taken cards, the dealer plays his hand. He must take a card if his total is 16 or less, or if he has a "soft" 17, that is, an Ace and a 6; otherwise he must "stand." If the dealer busts, all players who haven't already busted are paid. If he didn't bust, his point count is compared to all the players who have not already busted. If he is closer to 21, the dealer wins. If they are the same, there is a push, or no winner. If the player is closer to 21 than the dealer, then the player wins.
Implementation Write programs for all of the following as described below and include a UML diagram.
Player abstract class should include the following items:
-
ArrayList for storing the player deck cards values and suites
-
A variable for storing the points total of the player
-
A pushing method for receiving a new card from the dealer
-
A method for displaying the current deck of cards
-
A getter method for points total
Dealer class should include the following items:
-
A constructor method
-
Implementation of the push method that stores the card value and suite and
increases the points total accordingly. Keep in mind that depending on the predicted points total, the added value of an Ace can differ. This should be reflected in your method design
-
Implementation of the method for displaying the current deck of cards.
-
Implementation of the getter method for the total.
Gambler class should include the following items:
-
A constructor method
-
Implementation of the push method that stores the card value and suite and increases the points total accordingly. Keep in mind that depending on the predicted points total, the added value of an Ace can differ. This should be reflected in your method design
-
Implementation of the method for displaying the current deck of cards.
-
Implementation of the getter method for the total.
Blackjack program should include the following
-
ArrayLists for storing the card values and suites in a pack of cards.
-
A dealer and gambler object that participate in the game.
-
A means for randomizing the cards that get pushed to the dealer and
gambler.
-
Implementation that keeps into account all the game rules
Gambler must be able to quit at any time. Total of 21 results in an automatic win Total bigger than 21 is a loss Dealer total that is greater than gambler total but lower than 21 is a loss. Dealer always has a hidden card that gets flipped at the end of the game.
SAMPLE OUTPUT
------DEALER------
2 of Clubs 3 of Spades Jack of Hearts
2 of Hearts Total Score for Dealer: 17
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started