Instructions You will not be playing the game, merely dealing the cards. There are four players and each player receives 10 cards. The cards are dealt to the players one by one. That is, Player 1...








Instructions You will not be playing the game, merely dealing the cards. There are four players and each player receives 10 cards. The cards are dealt to the players one by one. That is, Player 1 receives a card, then Player 2, then Player 3, then Player 4. This repeats 9 more times. A deck of playing cards has four suits: ♠ (spades), ♣ (clubs), ♦ (diamonds), and ♥ (hearts), and each suit contains Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, and a King, for a total of 52 possible cards. You will use random numbers to choose the suit and number of the cards that are dealt to the players. You must keep track of what cards have been dealt so that no two players receive the same card. For example, there is only one 10 of ♣; but the random numbers might generate that card as Player 2's first card and later generate the same card as Player 3's tenth card. If the card has already been dealt to a player, then the next card is dealt instead. NO INPUT IS NECESSARY Processing Create a table to represent your players' hands Create a list to keep track of playing cards that have already been dealt Do the following 10 times: For each player: Generate a random suit number (integer) in the appropriate range. Generate a random card number (integer) in the appropriate range. If the card has not been dealt already, save it to the appropriate player's hand save it to the dealt cards list If the card has already been dealt, get a new card. Do not move to the next player until the current player receives a card that has not been dealt before. Output Calculate and output what each player's hand is worth as shown in the examples below. The cards have an integer value based on the following: "Ace" = 1 "2" = 2 "3" = 3 "4" = 4 "5" = 5 "6" = 6 "7" = 7 "8" = 8 "9" = 9 "10" = 10 "Jack" = 10 "Queen" = 10 "King" = 10 Sample input/output: Input 23451 Output Player 1 total: 70 Player 2 total: 63 Player 3 total: 65 Player 4 total: 65 34235 Player 1 total: 70 Player 2 total: 70 Player 3 total: 64 Player 4 total: 47
Nov 11, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here