success error

Form Is Invalid!

Download Guided COMP274 Lab 1

Download Guided COMP274 Lab 1

 

I L A B O V E R V I E W

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.
Deliverables
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 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 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 exercise’s 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 it. 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 characters, where the first dimension represents the suit and the second dimension represents the card in the suit, such as the following.
i. char CardDeck[4][13];
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 cards
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 the 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 values and the 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 it.
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 occurs:
. 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.

Need to Purchase Labs?

Are you suffering together with your online classes? Are you wondering, can I pay a person to finish elegance online for me? Do you need a person that will help you out? You have come to the proper place. At Get Exam Done, we provide skilled lecturers who will cope with your everyday online elegance portals. You do not ought to do anything, not to mention search, or pay someone to take my online class. Everything in your portal could be accomplished from our quit, including assignments, discussions, and quizzes.

 

Placeholder $3.99
Download Guided COMP274 Lab 1
  • 200+ Downloads
  • 8k Views