Computes and stores appropriate points for given face value

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

Project Assignment: Blackjack Card Class

New Chapters Covered:

• Structures and Classes
• Constructors and Other Tools
• Operator Overloading and Friends

Specification:

You will design a Card class which will be used for blackjack-style playing cards. Because the expected game is Blackjack, we will want to design functionalities and store information which is relevant to that game in particular. For this assignment, you are not required to create a full blackjack game. Rather, you are only required to create the class for handling the card objects.

A Deck of Cards:

Each card has one of four suits: Spades, Clubs, Diamonds, and Hearts.

There are 13 face values: Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, and King

The 52 cards in the deck represent all possible pairs of a suit and face value.

A Hand of Cards - Evaluating Points:

A hand is a subset of the cards in the deck. In blackjack a hand is worth a certain number of points. The goal is to have a hand which is worth as close to 21 points as possible without going over.

The points of a particular card are based upon the card's face value and, in the case of the Ace, based upon the total value of the hand.
Face values 2 through 10 are worth points equal to their face value.

Face values of Jack, Queen, and King are each worth 10 points.

An Ace is worth 11 points if the hand is worth less than or equal to 21 points; otherwise the Ace is worth 1 point.

Card Class Public Members:

• 4 constructor functions:

Card();

creates card with default private data for an Ace of Spades.

Card(intmyvalue);
creates of the given face value. Computes and stores the appropriate points for the given face value. Set the suit as Spades.

Card(intmysuit, intmyvalue);
creates card of the given suit and face value. Computes and stores the appropriate points for the given face value.

Card(intmysuit, intmyvalue, intmypoints);
Creates card of the given suit and face value worth the given number of points. (Will use to create composite cards as part of the + overloading)

• 2accessor functions:

intGetPoints() const;
Returns the integer value of the calling card's point value.

stringGetCardName()const;

Returns a string describing the card's suit and face value (see the sample output for examples). Returned string should be of the form: "Face Value Name" of "Suit Name"

• 3 comparison operator overloads:

friend bool operator == (const Card& lhs, const Card&rhs);

Returns true if the two cards have the same value and false otherwise. Output an error message and exit if comparison is made to a composite card.

friend bool operator < (const Card& lhs, const Card&rhs);

Returns true if the left card's value is less than the right card's and false otherwise. Properly treats Aces as being greater than the other cards. Output an error message and exit if comparison is made to a composite card.

friend bool operator > (const Card& lhs, const Card&rhs);

Returns true if the left card's value is greater than the right card's and false otherwise. Properly treats Aces as being greater than non-aces cards. Output an error message and exit if comparison is made to a composite card.

• 1 addition operator overload:

friendconst Card operator +(const Card& lhs, const Card&rhs);

Add the point values of two cards together and compute their combined points as part of a blackjack hand. Properly reduces the value of an ace to 1 if the combined value would be greater than 21. Returns a composite card with the composite point value. Assigns a composite suit of 5 to the returned card. Assigns the composite card a face value of Ace if one of the two cards was an Ace and its value was not reduced to 1; otherwise assigns a composite face value of 14.Pseudocode for the algorithm is as follows:

New_Points = card1_points + card2_points

If either card1 or card2 is an ace:

If New_points> 21:
New_points = New_points - 10
New_FaceValue = Composite Face Value
Else:
New_FaceValue = Ace
Else:
New_FaceValue = Composite Face Value
Return NewCard with New_Points, New_FaceValue, and Composite Suit.

Attachment:- C++-Project.rar

Reference no: EM131669002

Questions Cloud

Formulate a binary integer linear programming model : Formulate a binary integer linear programming model that will enable Bayside's management to determine the locations for the camera systems.
Recommend the use of wds : In what type of situations would you recommend the use of WDS and in which you would not Provide an example of each type of situation.
What are your companys strengths : What are your company's strengths? What are your company's weaknesses? What are your company's opportunities? What are your company's threats?
Steps needed to perform the system rmdir : Briefly explain the steps needed to perform the system rmdir("d2"), which removes the directory called d2 from the current directory.
Computes and stores appropriate points for given face value : Creates of the given face value. Computes and stores the appropriate points for the given face value. Set the suit as Spades.
How many units of each subassembly roedel should purchase : Determine how many units of each subassembly Roedel should manufacture and how many units of each subassembly Roedel should purchase.
Review article related in bloomberg business : How does the subject matter in this article tie in with at least three topics or concepts that are discussed in the textbook?
What are the revenue recognition policies for each company : MFE 6110 - What are the revenue recognition policies for each company and How do the two companies account for their intangible assets
Address verification in ipv4 and ipv6 : How does ICMPv6 differ from ICMPv4 and what is the difference in how automatically generated addresses are verified in IPv4 and IPv6.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  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

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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