Project 4 BLACK JACK PROGRAM
This, the fourth and final project, is a Java Program that has the user playing Black Jack with the dealer (the computer).
The rules of this Black Jack game are as follows:
The user
will play Black Jack against the computer. The
user’s goal is to get as close to 21
points without going over that sum. The
program will deal the user one card at a time and display the total of
all
previous cards. The program should print
the card that was drawn (Example: The card is the 2 of Diamonds and add that point
value to the
user’s total) The user will decide after each card dealt whether he/she
wants
another card. If the card brings the
user’s total over 21, the user loses immediately. After
the user decides to stop (with a total
of 21 or less) the dealer (computer) will play and continue to play
until the
dealer matches or goes over the user’s total.
(The computer should display the dealer’s card as well as the
dealer’s total thus far, just as it did for the user)
If the
dealer’s total equals or is higher than the user’s total without
going over 21, the dealer (computer) wins otherwise the user wins. The user will then be asked if he/she wants
to play again. The computer keeps track
of the user’s wins and losses and displays those totals after the user
decides
to quit playing.
Point values of cards
An Ace
can be viewed as either a 1 or 11 point value
When the
user draws an ACE the user will be asked then if he/she wants a
1 or 11. The program must keep asking for a 1 or 11 until the
user puts in either 1 or 11. The program must
continue to aske the user for a 1 or 11 until the user inputs a 1 or 11
whan an Ace is drawn.
If the dealer gets an Ace the program must check to see if his total +
11 will be greater than 21. If so then make the dealer's Ace a
one , otherwise make it an 11.
NOTE: The user must decide the
point value of the ACE when it is drawn and that value cannot change
later. This is also true of the dealer. When
an Ace is drawn the decision of a 1 or 11 is made at that point and
cannot be changed later. (This is a little different
from
the normal
game).
The
value of the cards are as follows:
Ace (1 or 11) all other number cards have the point value on the
card ( a 2 is worth 2 a
3
is worth 3 etc.)
Face
cards (Jack Queen King) have
the value of
10.
A deck
contains 52 cards. Four suites (Hearts,
Diamonds, Spades, Clubs)
and each suites contains the following cards:
Ace, 2,3,4,5,6,7,8,9,10,Jack, Queen, King).
NOTE:
In this game it is possible for the same card to appear more
than once
in a single game. (This would be rare
put possible and thus differs from a real game)
The
program at the beginning should
include an option to show the rules of the game.
Sample
run:
WELCOME
to BLACK JACK!!!!!
If you would like to see the rules type yes otherwise type no
yes
These
are the rules
(display the rules of the game)
If
you would like to play a game type yes otherwise type no
yes
The game begins with this your
first card
The
card is the Jack of Hearts
Your
total value is 10
Would you like to draw another card? Please answer yes or no
yes
The
card is the Ace of Diamonds
Do
you want the value of your Ace to be one or eleven?
Type 1 for 1 or 11 for 11
11
Your
total value is 21
Would you like to draw another card? Please answer yes or no
The
dealer now draws
The
card is the 10 of Spades
The
dealer's total is 10
The
card is the 10 of Hearts
The
dealer's total is 20
The
card is the 8 of Clubs
The
dealer's total is 28
Congratulations
you win with a total of 21
If you would like to play another game type yes or no
no
You
won 1 game(s) and lost 0 game(s)
To get
full credit you must meet the specifications as defined above. You must have a full deck (52 cards) and give
all the options as outlined in the specs and example given above. This includes giving the user the option to
see the rules (and thus printing the rules if that option is chosen),
playing
with a full deck, describing each card dealt (ex. 10
of Diamonds) and adding the value of the
card to the user’s total (or dealer’s total if it is the dealer’s turn). The program must determine if the user won or
lost and
keep a running total of the user’s wins and losses that will be
displayed after
the user decides to quit playing the game. The user must be given the option to play
again after each game is over. It must include an array
that contains the drawn cards os that the same card will not come up during the
game. NOTE: Any program that contains syntax errors
will receive a grade of 0%!!!!!!!
If you
decide the above program is too difficult you have the following
options.
Maximum
grade of B. Play
only 1 game. No running totals of wins or
losses. No need to give option to see
rules.
Note:
Call the
class where your main program is located PlayBlackJack and call the
class of
your method library PickACard.