Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose, 4 Players are playing a game of cards. Players are distributed cards fr

ID: 3885043 • Letter: S

Question

Suppose, 4 Players are playing a game of cards. Players are distributed cards from a standard 52-cards deck randomly. Before starting the game each player sorts the cards in their hand for convenience during the play. While sorting, a player first looks at the suits and groups same suits together. For this certain version of that game, the order of the value of suits is as follows: a. spades b. hearts c. diamonds d. clubs Among the same suit of cards the order of cards: A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2 Write a class Card Write a class Player that has a. An array of 13 cards b. A method to sort the array of cards (you can use the Insertion Sort shown in the class) A sample test program is given here: 1 package hw.cse214.cards: 2 3 public class CardSortingTest { 4 5 public static void main(Stringn args) { 6 7 String[] cardsForPlayerl - { 8 "S4", "08", "C4 "03", "DS", "DJ", "S3", "D4", "DA", "SJ", 9 "D7", "H10", "D6" 10 }: 11 Card[] cards - new Card[13]: 13 for (int i = 0: i

Explanation / Answer

procedure TDeck.Shuffle; var ctr: Byte; tmp: Byte; random_number: Byte; begin { Fill the deck with unique cards } for ctr := 1 to 52 do Card[ctr] := ctr; { Generate a new seed based on the system clock } randomize; { Randomly rearrange each card } for ctr := 1 to 52 do begin random_number := random(51)+1; tmp := card[random_number]; card[random_number] := card[ctr]; card[ctr] := tmp; end; CurrentCard := 1; JustShuffled := True; end;