Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Description: Blackjack is a card game consisting of two players, the user ( you ) and the dealer ( the computer ) . Each player
Description: Blackjack is a card game consisting of two players, the user you and the dealer the computer Each
player is randomly dealt two cards which can be valued from to Both user and dealer can draw additional cards.
Winning conditions are as follows:
Both user's and dealer's sums of cards are smaller than or equal to and user's sum of cards is greater than
dealer's sum of cards.
Dealer's sum of cards are greater than and user's sum of cards are smaller than
Losing conditions are as follows:
Winning conditions are not satisfied.
Steps:
Each player user and dealer are randomly dealt two cards each from the array mentioned above. User and
dealer can draw the same cards.
After dealing the cards, display the user's cards and their sum separately in the command window. ie "User
Card "User Card "User Sum"
Display ONLY the first card of the dealer in command window. ie "Dealer Card
Add the option to draw another random card from the deck for the user by asking for an input in the command
window. ie "Draw another card? YesNo
Keep asking the question in part e until the user types in No
Add the drawn cards to the previous sum. Display the drawn cards and the new sum in the command
window. ie "User Card "User Card "User Card N "New User Sum"
Sum the cards of dealer but DO NOT display it to the user.
Draw a single card for the dealer with probability if the sum of initially dealt cards are less than If
another card is dealt to the dealer, add it to the previous sum.
Display the total sum of the dealer in the command window. ie Dealer Sum
Determine the winner of the round considering the Winning and Losing conditions in the Description section.
Display the winner in the command window. ie "Useror Dealer won this round!"
Repeat this process for in total of rounds. Finally, determine the winner of the game and display it in the
command window along with the score. ie "Useror Dealer won the game by A sample output of the
final round is given in Fig.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started