Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is my Java Project: A simple blackjack card game consists of a player and a dealer (the computer). A player is dealt cards, called

This is my Java Project:

A simple blackjack card game consists of a player and a dealer (the computer). A player is dealt cards, called a hand, as is the dealer. Each card in the hand has a point value. Cards with a number (2-10) have the number of points associated with their face valuee.g., a 5 has a value of 5 points. Picture cards (jack, queen, king) each have a value of 10 points. An ace can have a value of 1 point or 11 points at the discretion of the player. The objective of the game is to get as close to 21 points as possible without exceeding 21 points. A player that goes over is out of the game. The dealer deals cards to itself and a player. The dealer must play by slightly different rules than a player. A game proceeds as follows: A player is dealt two cards face up. If the point total is exactly 21 the player wins immediately. If the total is not 21, the dealer is dealt two cards, one face up and one face down. A player then determines whether to ask the dealer for another card (called a hit) or to stay with his/her current hand. A player may ask for several hits. When a player decides to stay the dealer begins to play. If the dealer has 21 it immediately wins the game. Otherwise, the dealer must take hits until the total points in its hand is 17 or over, at which point the dealer must stay. If the dealer goes over 21 while taking hits the game is over and the player wins. If the dealers points total exactly 21, the dealer wins immediately. When the dealer and player have finished playing their hands, the one with the highest point total is the winner. Play is repeated until the player decides to quit. A deck of playing cards contains 52 cards, made up of 13 cards from 4 suits (clubs, diamonds, hearts, and spades). You may assume that there are several decks or you may use a single deck. Regardless of the implementation, cards will need to be recycled if all the cards are used and there is no winner yet. The deck, or decks, should be shuffled prior to the start of a new gameand there are several ways to do that using random numbers. It is up to you to determine how an ace is valued. One approach is to provide players with a choice. Another approach is to program a strategy that will be automatically implemented. There are multiple strategies that can be usedone might be to always value an ace as 11 points so long as the total points in a hand will be 21 or less. A separate strategy may be needed for the dealer. In terms of program output, you can represent a playing card however you want. As an example, a queen of diamonds might be represented as Q-D, and a 9 of clubs might be represented as 9-C. You must use an object-oriented approach in designing and implementing this program.

Please keep this simple, many thanks!

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_2

Step: 3

blur-text-image_3

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 Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago