On completion of this assignment a student should be able to write simple Java application that:
You are required to design, develop and test a one player Java game application named "Blackjack".
Besides providing the required functionalities, your program should incorporate appropriate error handling. Comments are also to be inserted to improve program clarity. Before you start coding your program, you are strongly advised to carry out proper problem analysis and program design.
You are required to use JDK 1.5 developer version or later.
Blackjack is a card game which compares the values of cards hold by a player and the dealer.
In this game, the player and dealer attempts to accumulate cards of total values between 16 and 21. Total card values of below 16 and above 21 is consider as bust.
See image. figure1.png
Values of Cards
The game uses one or more decks of the standard poker cards. Suits (i.e. Heart, Diamond, Spade and Club) has no particular meaning in this game.
The cards are valued as follows:
The value on a player hand is the sum of the point counts of each card in the hand. For example, a hand containing (4,6,9) has the value of 19.
The Ace can be counted as either 1 or 11. It is assumed that the value of Ace always has the valuethat makes the best hand.
For example, the player has the beginning hand (Ace, 7). The total value can be either 8 or 18. If the player stops there, it will be 18.
If the player draws another card, and it is a (3), the player will then have (Ace, 7, 3). The player total value is now 21, counting the Ace as 11.
However, if the player draw a third card which is 9. The hand is now (Ace, 7, 9) which totals to 17.
Notice that now the Ace must be counted as only 1 to avoid going over 21.
Game Procedure
The game starts with the dealer shuffles the deck of cards. Then the player place bet. After the bet is placed, the dealer will deal (distribute) the cards to the players. The dealer make two passes so that the players and the dealer have two cards each. (Two passes means that the dealer must distribute the cards in such a way that, the first card belongs to the player, the second card belongs to the dealer, the third card belongs to the player and the fourth card belows to the dealer.)
The first card of the dealer and player are both hidden (i.e. face down) for each other. The dealer and player can view their own hidden first card.
The other cards (second card and above) are visible to both the dealer and player.
Once the player has the first two cards, the player can choose to “Stand” or “Hit”. If the player choose to “Hit” , the dealer will deal one more card from the deck to the player.
The player can then continue to “Hit” or choose to “Stand”.
The player can Hit a maximum of four cards.
After the player “Stand”, the dealer can choose to “Hit” (maximum of four cards) or “Stand”.
Once the dealer “Stand”, both the dealer and player must reveal the hidden cards and compare their values on hand.
If the dealer wins, the dealer takes all the bet placed by the player. If the player wins, the dealer gives the same amount of bet placed to the player.
All thecards on the table are shuffled and placed at the end of the deck. The game will start again unless the player choose to leave the game.
Develop a Java program for the Blackjack game describled above. You also required to develope an “Intelligent” dealer that will decide if it should “Hit” or “Stand”. A very basic implementation of the “Intelligent” dealer is as follow:
There are two modules in this program; Administration and Game Play module
This module allows the administor to
Your program should be able to handle error situations like where a player enter wrong password or has insufficient chips. You should look out for other possible exceptions and handle them too.