Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 3 : A longer game of Blackjack [ 5 0 pts ] Description: Blackjack is a card game consisting of two players, the user
Question : A longer game of Blackjack pts
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 users and dealers sums of cards are smaller than or equal to and users sum of cards is greater than dealers sum of cards.
Dealers sum of cards are greater than and users sum of cards are smaller than
Losing conditions are as follows:
Winning conditions are not satisfied.
Steps:
Definethesetofcardsasfollows;decktherearecardswithvalue
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 users cards and their sum separately in the command window. ieUser 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. ieDraw 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. ieUser Card User Card User Card NNew 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. ieUseror 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