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

  Need a prg that lets user enter total rainfal

Need a prg that lets user enter total rainfall for each of 12 months into an array of doubles,prg should then calculate and display total rainfall for year,the average monthly rainfall, and the months with highest and lowest amounts

  Write and test a function to calculate the sum of the series

stop accumulating the sum when the term to add or subtract becomes smaller than a given small number(precision) oassed as an argument.

  Question 1a doubly linked list is like a linked list except

question 1a doubly linked list is like a linked list except that each node has a pointer both to the next node in the

  Calculate and display the number of units of electricity

The manager of PG&E wants a program that calculates a customer's electric bill. He will enter the current and previous meter readings.

  Design in c a unix utility program gasp

Design in C a Unix utility program gasp. Command gasp [options] STRING FILE... must read listed files (FILE...) and copy each line from input to stdout if it contains STRING.

  Develop a basic temperature class

You have to develop a basic temperature class

  Implementation of data member counter of type int

Write the implementation (.cpp file) of Counter class. Here is the full specification of the class: A data member counter of type int.

  The two-dimensional array

1. Given the two-dimensional array declared by the following statement int myArray[4][3] = {{2,4,6},{1,8,10},{3,5,7},[9,11,13}}; what is the value of myArray[1][2]

  Random permutations

Write a program in C++ that gives a prompt to the users, asking for an integer M.It then prints out a M different random permutations, one on each of M lines, of the numbers 1, 2, ... , 10, separated by spaces or tabs.

  Write a method, to be included in a template unsorted list

Write a metho, to be included in a template unsorted list class, called replace_item, that will receive two xType parameters, one called olditem, the other called newitem.

  Write c program which compute acceleration of jet fighter

Write a C++ program which compute the acceleration (m/s 2) of jet fighter launched from aircraft-carrier based catapult, provided jet's takeoff speed in km/hr

  Create class integerset

Create class IntegerSet for which each object can hold integers in the range 0 through 100. Represent the set internally as a vector of bool values. Element a[i] is true if integer i is in the set. Element a[j] is false if integer j is not in the set..

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