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 1 to 13 with Ace being represented by a 1. Remember, that face cards (i.e. Jack, Queen, and King) are worth 10 points to a hand while an Ace can be worth 1 or 11 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 21, 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 (i.e. goes over 21 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 21. (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 1 and 13 (both values inclusive). If a 1 (i.e. Ace) is chosen for a card value for the human player, the player gets to choose which value either a 1 or 11 they want to add to their hand. Note: The computer just gets the 1 or 11 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 21. The player automatically loses if their hand goes over 21. The game ends and the player wins if the dealer's hand goes over 21 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 Page 2 of 3 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 do..while loop in the main method to the user. 1. Play Again 2. Exit Your program must have 2 additional methods at a minimum: 1. You must use a method to draw the cards (i.e. generate the card values as drawn). 2. You must use a method to determine the winner of the game after game play ends

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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 1 to 13 with Ace being represented by a 1. Remember, that face cards (i.e. Jack, Queen, and King) are worth 10 points to a hand while an Ace can be worth 1 or 11 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 21, 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 (i.e. goes over 21 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 21. (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 1 and 13 (both values inclusive). If a 1 (i.e. Ace) is chosen for a card value for the human player, the player gets to choose which value either a 1 or 11 they want to add to their hand. Note: The computer just gets the 1 or 11 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 21. The player automatically loses if their hand goes over 21. The game ends and the player wins if the dealer's hand goes over 21 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 Page 2 of 3 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 do..while loop in the main method to the user. 1. Play Again 2. Exit Your program must have 2 additional methods at a minimum: 1. You must use a method to draw the cards (i.e. generate the card values as drawn). 2. You must use a method to determine the winner of the game after game play ends

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 9 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education