Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Description In the game Blackjack players get two cards to start with. Then they are asked if they want more cards. Players can continue to

Description

In the game "Blackjack" players get two cards to start with. Then they are asked if they want more cards. Players can continue to take as many cards as they like. The goal is to get close to 21 without going over. If the total is greater than 21 we say the player "busted".

Write a command line game that plays a simple version of blackjack. The program should generate random numbers between 1 and 10 each time the player gets a card. It should keep a running total of the players cards, and ask the player whether or not it should deal another card. Sample output for the game is written below. Your program should produce the same output.

> First cards: 3, 2

> Total: 5

> Do you want another card? (y/n): y

> Card: 6

> Total: 11

> Do you want another card? (y/n): y

> Card: 7

> Total: 19

> Do you want another card? (y/n): n

Here is another sample run

> First cards: 10, 2

> Total: 12

> Do you want another card? (y/n): y

> Card: 6

> Total: 18

> Do you want another card? (y/n): y

> Card: 7

> Total: 25

> Busted.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Auditing Cases An Interactive Learning Approach

Authors: Steven M Glover, Douglas F Prawitt

4th Edition

0132423502, 978-0132423502

More Books

Students also viewed these Programming questions

Question

What are your goals for this interview today?

Answered: 1 week ago