Question: Task Write a Java program to simulate a blackjack game of cards. The computer will play the role of the dealer. The program will randomly
Task
Write a Java program to simulate a blackjack game of cards. The computer will play the role of the dealer. The program will randomly generate the cards dealt to the player and dealer during the game. Cards in this game will be represented by numbers to with Ace being represented by a Remember, that face cards ie Jack, Queen, and King are worth points to a hand while an Ace can be worth or points depending on the user's choice. The numbered cards are worth their number value to the hand.
Here are the details of how to play the game:
To start the game, the player is given two randomly chosen cards and told their values. The dealer is then given two cards randomly. The human player should only be told the value of the first card given to the dealer. The other card in the dealer's hand is "hidden" until the end of the game. The player is then asked if they want to draw another card for their hand. While the player wishes to draw another card and neither hand has gone over the game will continue. If the player wishes to draw, a new card value is drawn and added to the player's hand. Assume the dealer will take a card each time the player does until the dealer or player goes bust ie goes over points in their hand or the player stops the game by saying they no longer want to take another card. Once the player stops wanting to draw a card, the game ends and the result is told to the user. Remember, the game also ends when either the player or dealer goes over See additional game rules below.
Each time the user draws a card they should be told what value card they drew and their resulting hand value. Each time the dealer draws a card the human player should be told the new card value that was drawn by the dealer, but not the dealer's hand total. Remember, one of the dealer's cards is hidden from the player.
Card values for the player and computer will be chosen at random and range between and both values inclusive If a ie Ace is chosen for a card value for the human player, the player gets to choose which value either a or they want to add to their hand. Note: The computer just gets the or chosen for them randomly instead of getting a choice.
To win the game, the player must get higher than the computer's hand without going over The player automatically loses if their hand goes over The game ends and the player wins if the dealer's hand goes over at the draw of a new card by the dealer. The player loses if their hand is less than the dealer's hand once the player chooses to stop drawing cards. The player can tie with the dealer. The player wins if their hand is greater than the dealer's hand once the player chooses to stop drawing cards. Be sure to provide appropriate output the player when the game is over before presenting the player with the option to play again.
Provide the following menu using a dowhile loop in the main method to the user.
Play Again
Exit
Your program must have additional methods at a minimum:
You must use a method to draw the cards ie generate the card values as drawn
You must use a method to determine the winner of the game after game play ends.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
