Question: CS 251 Program 01 Main topics Programmer defined methods Random number generators Arrays Program Specification: You are to develop a program which emulates a full

CS 251 Program 01 Main topics Programmer defined methods Random number generators Arrays Program Specification: You are to develop a program which emulates a full deck of playing cards. That in 4 suits (Club, Spades, Hearts And Diamonds) and 13 mink (Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King) in each it. This of course makes for a total of 2 playing cards in the deck Mandatory methods public static void initDeck (boolean) duck) 1/ set the values of deck to indicate that they are all // present - not dealt yet. public static boolean emptyDeck (boolean I deck) // returns whether or not all the cards in the deck // have already been dealt. public static int deal Card(boolean I deck) // returns & card (an int in the range 0 to 51) at randon // that has not been dealt since the deck was initialize // via intDeck. Also notes (in deck) that this card is // no longer available. public static void print Card (int card) 1 given a card (an int is the range o to 51) prints // an appropriate representation of this card based // on a 1-1 and onto mapping of the set to, 61] to // the cards described above. Rules and Requirements . Your main method must end with the following block of code, which can not be modified boolean myDeck - new boolean (62): final int cardsPer Row - 8; int carde Thinlov - 0; int wyCard: initDeck (ayDeck): System.out.println(" Here is a shuffled deck ... "); while (!emptyDeck (syDeck)) { myCard - dealCard GayDeck): ++cardsThis low: if (cardsThiarow cu cardaPerRow) PEN { printCard (myCard); System.out.print(" "); } else { System.out.println(""); cardsThisRow - 1; printCard (myCard); System.out.print(" "); } } System.out.println(' '); Notes and Hint: 1. You should write and test your methods one at a time. Sample run(s): Here is a shuffled deck .. 7S KS 2H 6S 4C2D 9D 9C 4H 70 9H 3D 5D 10S 28 JH AH 4S KC QC AD QD 7D AS KD 5C 7H KH 3C JC 2C 4D 8H AC 5S 10C JS 3H 9S 8D 10D 8S 6C H 8C JD3S QS 6D 10H 6H Here is a shuffled deck ... 2D 10C AD 6C JC JH KS 48 9C 98 28 AC QS 3C 3H 8C 3S QC AS 4D 10S 2C 8S 6D 6S 9H 28 5S JD KD QH 10D 7H QD 3D 6H 7D 8H 5D 4H KH AH 8D 7C9D 7S 5C SH KC JS 4C 10H
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
