A player is dealt an initial hand of two cards. He has the option of drawing cards to bring the total
value to 21 or less without exceeding it, so that the dealer will lose by having a lesser hand than
the player or by exceeding 21. The dealer also receives an initial hand of two cards.
However,
only the first card is visible to all. The other card is not visible until the dealer's turn. The dealer
starts his turn after every player stood (decided to take no more cards) or busted (value above
21). A player hits when he decides to take another card from the dealer. A player busts when his
hand value is above 21. When a player is busted, his chips is immediately forfeited regardless
whether the dealer is busted or not. When a dealer is busted, the remaining players who are not
busted wins. When there is a tie between the dealer and the player, the chips is returned to its
player.
Develop a Java program for the Blackjack card game. Do not implement additional options such as
"double", "split" or "surrender".
Required Functionality
User registration of up to three players (A to C).
Player's name must be at least three characters.
Each player is to be given 100 chips at the beginning of the game.
Dealer has unlimited amount of chips.
Players cannot place chips of more than what they have.
Each player or dealer has a hand of maximum five cards.
Enforce turn-based dealing of cards to players.
Display the value of a player's hand after a card is dealt.
Allow players to stand or to hit.
A player leaves the game when he has no more chips.
The game ends when all players lose all their chips.
Coding Restrictions
You must use simple (1-D) arrays in this assignment.
You are not allowed to use 2-D arrays, ArrayList and LinkedList as your data structures.
You are not allowed to implement any form of GUI (E.g. Swing, AWT, etc.)
Sample Output
Players Registration
B L A C K J A C K
================================================== ==============================
Enter number of players (1-3) > 3
Enter Name of Player A > Ben
Enter Name of Player B > Joy
Enter Name of Player C > Frank
B L A C K J A C K
================================================== ==============================
Enter number of players (1-3) > 2
Enter Name of Player A > He
*** NAME TOO SHORT!
Enter Name of Player A > Bee
Enter Name of Player B > Jude
Displaying the Game
================================================== ==============================
Player A, You have 100
Enter number of chips to play > 100
Player B, You have 100
Enter number of chips to play > 100
Player C, You have 100
Enter number of chips to play > 80
--------------------------------------------------------------------------------
DEALER
<Heart Ace>
--------------------------------------------------------------------------------
Player A
<Club Five>
<Club Ace>
[H]it or [S]tand S
PLAYER A : Joe
Value : 16
Hand : <Club Five> <Club Ace>
--------------------------------------------------------------------------------
Player B
<Heart Two>
<Diamond Nine>
[H]it or [S]tand H
<Spade Two>
[H]it or [S]tand H
<Diamond Four>
[H]it or [S]tand H
<Diamond Ace>
[H]it or [S]tand S
PLAYER B : Ben
Value : 18
Hand : <Heart Two> <Diamond Nine> <Spade Two> <Diamond Four> <Diamond Ace>
--------------------------------------------------------------------------------
Player C
<Spade Jack>
<Diamond Jack>
[H]it or [S]tand S
PLAYER C : Tay
Value : 20
Hand : <Spade Jack> <Diamond Jack>
DEALER
Value : 21
Hand : <Heart Ace> <Spade Queen>
DEALER
Value : 21
Hand : <Heart Ace> <Spade Queen>
================================================== ==============================
Player A. Lost 100
Player B. Lost 100
Player C. Lost 80
================================================== ==============================
Player C, You have 20
Enter number of chips to play > 20
--------------------------------------------------------------------------------
DEALER
<Heart Four>
--------------------------------------------------------------------------------
Player C
<Spade Ten>
<Heart Six>
[H]it or [S]tand H
<Spade Six>
PLAYER C : Tay
Value : 22
Hand : <Spade Ten> <Heart Six> <Spade Six>
--------------------------------------------------------------------------------
DEALER
Value : 14
Hand : <Heart Four> <Club Ten>
[H]it or [S]tand S
DEALER
Value : 14
Hand : <Heart Four> <Club Ten>
Player C. Busted. Lost 20
G A M E O V E R
Various Messages Displayed During Game Play
================================================== ==============================
Player A. Won 80.
Player B. Tied with Dealer.
Player C. Busted. Lost 100.
Player A, You have 100
Enter number of chips to play > 120
*** YOU CANNOT PLAY MORE THAN WHAT YOU HAVE.
Player A, enter amount of chips to play >
################################################## #############################
I need to create 4 classes consists of BlackJackGame, Deck, Player and Card class
BlackJackGame consists of
dealer : Player
players : Player[]
deck : Deck
numPlayer : int
main(String []) : void
start() : void
registerPlayers() : void
ask PlayersPlaceChips() : void
dealCardsToDealer() : void
dealCardsToDealer2() : void
dealCardsToPlayers() : void
determineWinLoseOrTie() : void
isGameOver() : boolean
Deck class consists of
deck : Card[52]
cardsDispensed : int
Deck()
dispenseCard() : Card
createDeck() : void
shuffleDeck() : void
Card class consists of
suit : int
number : int
Card(int, int)
getScore() : int
getTitle() : String
display() : void
Player class consists of
id : char
name : String
chips : int
stake : int
hand : Card[5]
Player(Char, String)
leftGame() : boolean
placeStake(int) : void
win() : void
lose() : void
hit(Card) : void
valueOfHand() : int
clearHand() : void
displayStatus() : void