1 BlackJack Win Percent
Project assigned on: Friday Feb 17
Project due date: Thursday Feb 23
11:59 p.m. 2012
In this project, you are to write a program that estimates the probability of winning a
blackjack game between you and a dealer.
The program runs 1,000,000 rounds. For each round, you and the dealer draw two cards.
For each hand, if the cards are worth 17 or more, don’t pick any more. If they are worth
less than 17, draw a card. For our game, you can draw at most four (4) cards.
After both hands are finished drawing, compare the totals. If the player “busts” (has a
hand greater than 21), that is a loss. If only the dealer busts, the player wins. Otherwise,
if the player has a higher hand, the player wins. If the dealer has the higher hand, the
player loses. If they have the same value, they get a tie (“push”).
After comparing the hands, the result is added to a win, loss, or tie count. After
1,000,000 rounds, print the percentage of winning, losing, and tieing hands with these
2 Learning objectives
1. Learning how to separate code into methods to simplify code.
2. Using for loops to simulate a large number of actions.
3 Project Setup
Create a project4 folder in your cs180 folder. Save all your Java source files in this project4
folder. You will be turning in the contents of this folder when the project is completed.
Note: Use the commands below, if needed.