Question: Program Specification You are to write methods that will allow you to emulate a deck of cards to be used to play games of chance

 Program Specification You are to write methods that will allow you

to emulate a deck of cards to be used to play games

Program Specification You are to write methods that will allow you to emulate a deck of cards to be used to play games of chance Deck Description There is a deck of 36 cards: Each card has value a number in the range of 1, 9 printed on it 9 possible values Each card has a suit Club", "Spade", Heart "Diamond"] printed on it 4 possible suits Thus we will use the numbers from 0 to 35 (inclusive) to represent the cards. Given a card (10, 35): the card's number is given by card 9 1; the card's suit is given by card 9, where 0 "Club", 1 Spade", 2 Heart", and 3 Diamond The deck is "cut" by picking a random point to divide the deck, and then swapping the stack of cards below the cut point with the stack at and above the cut point. The deck is "shuffled" by doing the following repeatedly cut" the deck, then divide the deck exactly in half creating two stacks, and finally recombining the two stacks back into one by selecting the top card from each stack in alteration) Rules and Requirements: You must represent the deck of cards using an int Array of of size 36. For each of the following headings descriptions, write and use a method that adheres to it: public static int cardvalue (int card) Return the integer value [1, 9] of card public static String cardsuit (int card) Return the suit ("Club", Spade Heart "Diamond"] of card public static void display Card int card) Prints card in some reasonable report format public static void initDeck (int CJ deck) Assign the elements of deck, such that each element's value is the same as its inder. public static void cutDeck (int Cl deck) 1. Generate a random number cut in the range 6 to 24 inclusive. 2. Create two new int arrays top, bottom): the size of top being cut, the size of bottom being 36 cut 3. Copy the values of deck (from index 0 to index cut 1) into top and the values of deck from index cut to index 35) into bottom Program Specification You are to write methods that will allow you to emulate a deck of cards to be used to play games of chance Deck Description There is a deck of 36 cards: Each card has value a number in the range of 1, 9 printed on it 9 possible values Each card has a suit Club", "Spade", Heart "Diamond"] printed on it 4 possible suits Thus we will use the numbers from 0 to 35 (inclusive) to represent the cards. Given a card (10, 35): the card's number is given by card 9 1; the card's suit is given by card 9, where 0 "Club", 1 Spade", 2 Heart", and 3 Diamond The deck is "cut" by picking a random point to divide the deck, and then swapping the stack of cards below the cut point with the stack at and above the cut point. The deck is "shuffled" by doing the following repeatedly cut" the deck, then divide the deck exactly in half creating two stacks, and finally recombining the two stacks back into one by selecting the top card from each stack in alteration) Rules and Requirements: You must represent the deck of cards using an int Array of of size 36. For each of the following headings descriptions, write and use a method that adheres to it: public static int cardvalue (int card) Return the integer value [1, 9] of card public static String cardsuit (int card) Return the suit ("Club", Spade Heart "Diamond"] of card public static void display Card int card) Prints card in some reasonable report format public static void initDeck (int CJ deck) Assign the elements of deck, such that each element's value is the same as its inder. public static void cutDeck (int Cl deck) 1. Generate a random number cut in the range 6 to 24 inclusive. 2. Create two new int arrays top, bottom): the size of top being cut, the size of bottom being 36 cut 3. Copy the values of deck (from index 0 to index cut 1) into top and the values of deck from index cut to index 35) into bottom

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!