Design a simple game of blackjack

Assignment Help C/C++ Programming
Reference no: EM131882

Prepare a simple game of blackjack using object oriented programming.

UML Class Diagrams

1029_Design a simple game of blackjack.png

Your project must implement the following classes:

class BlackJack

The role of the Blackjack class is to encapsulate all of logic associated with playing the game of blackjack.

Note that all output visible in the Sample Output section is generated by BlackJack's play() method. The play() method should operate as follows:

Program Start

1. Output an introduction

Starting with the player, do the following

1. Deal the player a card.

2. Add the card's value to the player's total hand.

3.  Output the value of the card just dealt and the player's current hand total (score)

4.  Ask the player if he would like to hit or stand

5.  If the player hits, go back to #1

After the player busts or stands

1.  If the player has not busted, begin computer's play
2.  Deal the computer a card
3.  Add the value of the card to the computer's hand total (score)
4.  If a card causes the computer to bust (go over 21), output a message.  Go to step #7.
5.  If the computer's hand total is less than 17, it must take another card (hit).  Go to step #2. 
6.  If the computer's hand is 17 or more, the computer stands.
7.  Stop computer playWhen both player and computer are done

1. If the player has not busted and the computer busted, the player wins
2. If the player has not busted, the computer has not busted, and the player's hand total is greater than the computer, then the player wins
3. If the player has not busted, the computer has not busted, and the player's hand total is less than the computer's then the computer wins
4. If the player has busted, then the computer wins.

class Card

We use the card class to represent an individual card in a deck. Cards have a suit (Club, Diamond, Heart, Spade) and a rank (e.g. Two, Ten, Jack, Ace). Suit_t and Rank_t are enumerations that list the possible values. To simplify, we will assume that aces only play one role in blackjack and have a value of 11. Note that the Card class has a getRankValue() method that will return the integer value of the card.

class Deck

The Deck class is merely a collection of 52 cards. The private member variable "_used_indices" is used to track the cards previously dealt. Calling the resetDeck() method should re-initialize the deck of cards and clear out the list of previously dealt cards. For convenience, the Deck's constructor should automatically call resetDeck() to initialize the deck.

Reference no: EM131882

Questions Cloud

Impact of zigbee on telecommunication systems : Report on Impact of zigbee on telecommunication systems
Create a base employee class : Create a base Employee class and a derived StudentEmployee class
Regression model : What is the equation for this regression model?
Cost of capital to assess its restaurant capital investments : Considering investing in Facial Laboratories. Assume that Facial is currently undergoing expansion and is not expected to modify its cash dividend while expanding for the next four years.
Design a simple game of blackjack : Prepare a simple game of blackjack using object oriented programming.
Calculate the weighted average cost of capital : Calculate the Weighted Average Cost of Capital for three years to study and discuss the trend.
Developing business information system solutions : Equip Hire is a commercial and domestic equipment hire company with 11 branches across the metropolitan Sydney, Newcastle and Wollongong.
Preparing memo on state of the company industry : Preparing memo on state of the company industry
Explain diversity through annual reports : Explain diversity through annual reports of foreign companies on the internet.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create a program that maintains the required book catalog

Create a program that maintains the required book catalog for the circulation desk of a library.

  Develop a basic temperature class

You have to develop a basic temperature class

  Write a program using vectors and iterators

Create a program that uses at least two functions that will be called from your main. This program is a number game program that asks for parts of your phone and after manipulating it mathematically, eventually outputs your entire phone number. The d..

  Public transport fare ticketing system

Implement and test a public transport fare ticketing system.

  Prepare a program that uses at least two functions

Prepare a program that uses at least two functions that can be called from your main.

  Prepare a linear support vector machine svm

Write a computer program to prepare a Linear Support Vector Machine SVM

  Write two short c programs and solve exam-style problem

Write two short C programs and solve four exam-style problems.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Create a program for a company named retail-mart

Prompt the user to enter an item name (one word only), a quantity and a price. For this step, in addition to functionality, I'll be looking at: location of the variable declarations; appropriateness of data types selected; appropriateness of the va..

  Iterative programming problem solving approaches

Write a recursive function void reverse ( ) that reverse a sentence

  Prepare an accounting for a dorm''s kitchen

The "purpose" of the program is to prepare an accounting (database) for e.g. a dorm's kitchen, to keep track of the consumption of beer for each room.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd