Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java In the card game named 'blackjack' players get two cards to start with, and then they are asked whether or not they want more

Java image text in transcribed
In the card game named 'blackjack' players get two cards to start with, and then they are asked whether or not they want more cards. Players can continue to take as many cards as they like. Their goal is to get as close as possible to a total of 21 without going over. Face cards have a value of 10 Write a command line game that plays a simple version of blackjack. The between 1 and 10 each time the player gets a card. It should keep a running total of the play whether or not it should deal another card. Sample output for the game is written below. Your program should produce the same output. program should generate random number ers cards, and ask the player First cards: 3, 2 Total: 5 > Do you want another card? (y): y > Card: 6 Tota1: 11 > Do you want another card? (y): y > Card: 7 Tota1: 19 Do you want another card? (y): n > Would you like to play again? (y): y > First cards: 10, 2 > Total: 12 > Do you want another card? (y): y > Card: 6 > Total: 18 > Do you want another card? (y): y > Card: 7 Total: 25 Bust. > Would you like to play again? (y): n Note: You can generate random numbers using the Random class. Here is a tiny class that generates either a 0 or a l import java.util. public class RandomTest ( public static void main (String args[) Random random = new Random(); System.out-println (random.nextint (2))

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

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions

Question

What is quality of work life ?

Answered: 1 week ago

Question

What is meant by Career Planning and development ?

Answered: 1 week ago

Question

What are Fringe Benefits ? List out some.

Answered: 1 week ago