Prepare a simple game of blackjack using object oriented

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

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: EM13347949

Questions Cloud

Questiondetails areimpact of zigbee on telecommunication : questiondetails areimpact of zigbee on telecommunication systems. in this report need to either do some measurement or
Create a base employee class and a derived studentemployee : create a base employee class and a derived studentemployee class. below is the basic uml structure of both
Part -1make sure you read the output carefully this output : part -1make sure you read the output carefully. this output pertains to a set of juvenile court data looking at the
Cost of capital to assess its restaurant capital : cost of capital to assess its restaurant capital investmentsthere are four questions. all questions are
Prepare a simple game of blackjack using object oriented : prepare a simple game of blackjack using object oriented programming.uml class diagramsyour project must implement the
1nbsp select two companies from the same industry2nbsp : 1.nbsp select two companies from the same industry2.nbsp gather financial data from web sites refer items 2 4 and 9 of
Case study equip hireequip hire is a commercial and : case study equip hireequip hire is a commercial and domestic equipment hire company with 11 branches across the
Preparing memo on state of the company industryassume that : preparing memo on state of the company industryassume that you are audit senior in an accounting firm. your firm has
Worldwide accounting diversity international accounting : worldwide accounting diversity international accounting doupnik and pereraexplain diversity through annual reports of

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Consider the following einf gramar for the simple calculator

Consider the following EINF gramar for the simple calculator language mentioned in class.

  Generate a set of 75 random integers in the range -26 to + 4

Write a program that will generate a set of 75 random integers in the range -26 to + 42. The program

  You are to create a program

You are to create a program that will input a group of floating point values, storing them as double values in an array. This array will then be sent to three functions.

  How to call a function from main

Call a function from main(), passing one value to it. Return TWO values, both the square of the number and the number to the power of three.

  This program will simulate the game of hearts

This program will simulate the game of Hearts, which is a four-player trick-taking game using any ordinary deck of playing cards. Each player is dealt thirteen cards. Whoever is dealt the Two of Clubs must lead it to the first trick. Each person p..

  Write an interactive program that prompts for a desired sum

Write an interactive program that prompts for a desired sum, then repeatedly rolls two six-sided dice until their sum is the desired sum. Here is the expected dialogue with the user.

  Function that returns the height of a binary tree

Write a function called getHeight() that returns the height of a given binary tree - CptS 122 Write a function called countSmallerThan() that returns the number of nodes whose values are smaller than the supplied input paramter

  Write a class called fraction

Write a class called Fraction (this is not related to problem 2 from the text).

  Writing function that computes leap years

Write down function that computes leap years. Function prototype is as follows: Write function body which returns true if year is a leap year and false if year is not a leap year.

  Wave steepness is the ratio of wave height

Wave steepness is the ratio of wave height (WH) to wave length(WL) and is an indicator of wave stability. When wave steepness exceeds a 1/7 ratio; the wave becomes unstable and begins to break. Assume a data file exits with the following header

  Object-oriented systems is the concept of object

At the heart of all object-oriented systems is the concept of an object. Simply stated, an object is a set of related characteristics and their associated actions.

  Write a function named sort3

Write a function named "sort3" that takes three floating point arguments, call them "x" , "y" , and "z" , and modifies their values, if necessary, in such a way as to make true the following inequalities: x y z .

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