Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Blackjack The project is the design and implement of a java program which is capable of playing a series of Blackjack hands. For consistency, everyone

Blackjack

The project is the design and implement of a java program which is capable of playing a series of Blackjack hands. For consistency, everyone will use the rules from en.wikipedia.org/wiki/Blackjack as qualified below.

The game will support from 1 to 4 decks (chosen at the beginning of play)

The game will support either hit soft 17 or stand on all 17s (specified at the beginning of play). A soft 17 is when the dealer has an ace. For example, an ace and a 6 could be 7 or 17 (thats why its called a soft 17)

Payoffs are 1:1 or 3:2 for player blackjack

Minimum/maximum bet is $2 to $100 in increments of $2

Player decisions are: Hit, Stand, Double down

Not supported: Double after split, double on 9/10/11 or 10/11, European no-hole-card rule, altered payout, or insurance.

Your program will be the dealer and will play against a single player. At the beginning of the game, the player will be credited with $1000 in betting chips. The game ends whenever the player is broke or the player indicates to terminate the game. The game will keep track of the players chips and adjust it accordingly based on wins/loses. The user interface should permit the player to interact with the game in a fashion analogous to playing the game in a casino. To wit:

Cards are dealt as follows: Player, Dealer, Player, Dealer. When the cards are dealt, both player cards are face up. One dealer card is face up the other face down. The players hand value is displayed (NOTE: could be two values if one of the cards is an ace). The players hand value is updated when he/she is dealt an additional card.

Until the player stands or goes bust, each hit request causes one more card to be dealt to the player face up. If after the first 2 cards are dealt to the player and the player opts to double down, the initial bet is doubled (provided therere enough chips in the cache to do so) and the player is dealt only one additional card.

If the player goes bust, the program indicates that fact. No additional cards are given to the dealer and the face down card remains face down (we wont ever know its value).

If the player stands, the dealers face down card is revealed, any additional cards dealt to the dealer are shown and a statement as to who is the winner is displayed and the players chip count is updated. If the hand is a tie, the players bet is maintained but the player has the option to increase the amount of the bet.

The user interface displays the number of cards remaining in the shoethis number is updated as each card is dealt.

A sample program execution is shown later in this document. Yours may vary somewhat, but it should still contain the data shown and the interaction should be very similar.

Youre expected to create a class (BlackjackGame) which contains the processing logic. One other required class is the Shoe. The Shoe holds the shuffled cards and it is from the Shoe the cards are dealt. After each Blackjack hand is played, the cards on the table are collected and placed in a hopper (a holding area). When the last card is dealt from the Shoe, the cards in the hopper are shuffled and transferred to the Shoe and the program continues. While not required, most likely youll have Card, Hand and Deck classes, but thatll be up to you.

Neither BlackjackGame, Shoe, or any of the supporting classes will have any display capability. For that, you are to create a console user interface (UI) front-end which is the go-between between the user and BlackjackGame. The class, BlackJackUI is the mechanism by which all interaction/output is accomplished via the interaction pane. In other words, the back-end classes (BlackJackGame, Shoe, et al.) know nothing about the front-ends (BlackJackUI) implementation or vice versa.

----------------------------------

Sample program execution:

Welcome to BlackJack...first a few preliminaries

Enter your name (no spaces)

Doc

How many decks are being used? (1-4)

3

Now finally, does the dealer have to hit on soft 17? (Y or N)

Y

OK...Enter S to start or X to exit

S

Running BlackJack

Shoe now has 156 cards

DOC, you have $1000. Enter your bet or exit (X)?

100

Shoe now has 152 cards

Dealer: 8D XX

DOC : QD 2D (12)

Bet=$100 Cache=$900

Options: Hit (H), Stand (S), Doubledown (D), Exit (X)

H

Shoe now has 151 cards

Dealer: 8D AC

DOC : QD 2D TS

Sorry... you're busted.

DOC, you have $900. Enter your bet or exit (X)?

150

Shoe now has 147 cards

Dealer: JC XX

DOC : 6D 7C (13)

Bet=$150 Cache=$750

Options: Hit (H), Stand (S), Doubledown (D), Exit (X)

H

Shoe now has 146 cards

Dealer: JC XX

DOC : 6D 7C 4H (17)

Bet=$150 Cache=$750

Options: Hit (H), Stand (S), Doubledown (D), Exit (X)

S

Shoe now has 145 cards

Dealer: JC 4S 7S

DOC : 6D 7C 4H

Dealer has 21, you have 17 Sorry... you lose

DOC, you have $750. Enter your bet or exit (X)?

300

Shoe now has 141 cards

Dealer: AC XX

DOC : 7H JH (17)

Bet=$300 Cache=$450

Options: Hit (H), Stand (S), Doubledown (D), Exit (X)

D

Shoe now has 139 cards

Dealer: AC 3D 7D

DOC : 7H JH 4D

Tie game. Your current bet is $600 Do you wish to make an additional bet? Yes (Y) or No (N)

N

Bye

Submission Requirements:

Document each back end class by describing its:

Data members

Constructors

public methods (functionality, parameters, return value)

private methods (if any, functionality, parameters, return value)

Junit test files for all back end classes. Include a screenshot showing the outcome of running the unit tests. NOTE: for testing purposes provide a compile-time variable (e.g., boolean testing = true/false;) in the Shoe class. If this variable is false, the Shoe deals cards from a set of shuffled decks. If this variable is true, Shoe reads cards from a text file and deals those cards. Ergo, when testing, Shoe reads a stacked deck so that when dealt, specific Blackjack hands can be handled.

Provide the stacked deck file and all of the .java files in your program/package

Sufficient test runs (with screenshots) with testing = true that illustrate requirements 1-5 and specified game progression are implemented.

Additional test runs (with screenshots) with testing = false that illustrate the randomness of the hands due to using shuffled cards.

Short feedback as to your experiences, trials, tribulations encountered in the project.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

3. Job rotation is used for all levels and types of employees.

Answered: 1 week ago