Scenario and Summary
This lab requires you to design and implement a C++ program to simulate a game of Blackjack between two to four players. Your program must incorporate a two-dimensional array to represent the suit and the value of each card dealt to a player, keep track of which cards have been dealt to which player, and use a random-number generator to pick each card to be dealt to a player.
1. Submit a single Notepad file containing the source code for Exercise 1 to the Dropbox for Week 1. Your source code should use proper indentation and be error free. Be sure that your last name and the lab number are part of the file name: for example, YourLastName_Lab1.txt.
Each program should include a comment section that includes, at a minimum, your name, the lab and exercise number, and a description of what the program accomplishes.
2. Submit a lab report (a Word document) containing the following information to the Dropbox for Week 1.
o Include your name and the exercise number.
o Specification: Include a brief description of what the program accomplishes, including its input, key processes, and output.
o Test Plan: Include a brief description of the method you used to confirm that your program worked properly. If necessary, include a clearly labeled table with test cases, predicted results, and actual results.
o Summary and Conclusions: Write a statement summarizing your predicted and actual output, and identify and explain any differences. For your conclusions, write at least one nontrivial paragraph that explains, in detail, either a significant problem you had and how you solved it or, if you had no significant problems, something you learned by doing the exercise.
o Answers to Lab Questions: Answer any and all of the lab questions included in the lab steps.
Summary: Write a statement summarizing your predicted and actual output; identify and explain any differences.
Conclusions: Write at least one nontrivial paragraph that explains, in detail, either a significant problem you had and how you solved it or, if you had no significant problems, something you learned by doing the exercise.
Each lab exercise should have a separate section in the lab-report document.
Your lab grade will be based upon
1. the formatting of your source code;
2. the use of meaningful identifiers;
3. the extent of internal documentation;
4. the degree to which an exercises’ specifications are met; and
5. the completeness of your lab report.
i L A B S T E P S
STEP 1: Starting Visual Studio
Create a new Visual Studio empty project, and add one C++ source code file.
STEP 3: Program Specifications
1. There is always a dealer in the game.
a. At the start of the game, the dealer’s first card will not be shown or displayed. The second card will be displayed.
b. The dealer may draw additional cards.
c. The dealer must use a random-number generator to determine the maximum number of cards the dealer will draw–a value between 0 and 3. In other words, the dealer is a computer player.
d. The dealer does not show all the cards or the total until all the players have either gone bust (over 21) or hold (no more cards drawn).
2. There must be at least one other player (you) and up to a maximum of four other players (all played by you).
. On a player’s turn, that player may either draw a card or hold. Once a player holds, he or she should not be asked to draw another card during this game.
a. All the cards for each player, including the first card dealt, are displayed, along with the suit symbol: spades ♠, clubs ♣, hearts ♥, or diamonds ♦.
3. Each game will start with a new, 52-card deck, which is modeled on a real deck of cards.
. The card deck has 52 cards with no jokers.
a. The card deck is represented by a two-dimensional array of data-type character, where the first dimension represents the suit and the second dimension represents the card in the suit, such as the following.
i. char CardDeck;
b. At the start of each game, each element of the two-dimensional array is initialized to a value of ” “, or the “space” character.
c. The deck has four suits, represented by the following dimension indices.
. 0 = diamonds
i. 1 = hearts
ii. 2 = clubs
iii. 3 = spades
d. Each suit has 13 cards: 2, 3, 4, 5, 6, 7, 8,9 ,10, jack, queen, king, and ace.
e. Each card in a suit is represented by the following dimension indices.
. 0 = the 2 card
i. 1 = the 3 card
ii. 2 = the 4 card
iii. 3 = the 5 card
iv. 4 = the 6 card
v. 5 = the 7 card
vi. 6 = the 8 card
vii. 7 = the 9 card
viii. 8 = the 10 card
ix. 9 = the jack
x. 10 = the queen
xi. 11 = the king
xii. 12 = the ace
f. All the number cards are worth their face value (i.e., a 3 of diamonds is worth 3).
g. All face cards are worth 10.
h. An ace is worth either 1 or 11. Your final-score calculation must be able to handle this correctly for both the dealer and each player.
i. A random-number generator must be used to select the suit and the card in the suit.
. Once a card and suit are selected, the program should check if the value of that array element is a “space.”
1. If the array element = “space,” set the element equal to an integer, identifying the dealer or the player.
a. 0 = dealer
b. 1 = player 1
c. 2 = player 2
d. 3 = player 3
e. 4 = player 4
2. If the array element ! = “space,” then the random-number and card-checking process should repeat until a “card” or an array element is selected that is = “space.”
j. Once a card is drawn during a game, it cannot be drawn again.
4. When the program first starts, it should prompt the user, asking if he or she wants to play a game of Blackjack or exit the program.
5. If the user inputs to play the game, the next decision should be 1, 2, 3, or 4 players.
6. At the start of the game, the dealer and each player should be dealt two cards. One of the dealer’s card’s value and suit should not be displayed.
7. The number of cards that the dealer will draw during a game should be determined by a random-number generator that will return a value of 0, 1, 2, or 3 cards to be drawn.
8. Each player may then draw a card or hold.
9. If, after drawing a card, any player or the dealer goes over a score of 21, he or she is not allowed to draw any more cards during the game.
10. Once a player holds, he or she should not be asked to draw a card again during the game.
11. The game continues until one of the following conditions occur:
. all players have declared hold;
a. all players and the dealer have gone over 21;
b. a maximum of five cards total are held by any player at the end of a round of card draws; or
c. any combination of the above.
12. The display should show each player’s (and the dealer’s) hand and update the display after each round of card draws.
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at [email protected].
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at [email protected] and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at [email protected].
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.