Question: 3. Deck of Cards Create an array whose elements hold the first initial of four different suits in a card deck. Declare an array that

3. Deck of Cards Create an array whose elements hold the first initial of four different suits in a card deck. Declare an array that can hold a representation of the cards in a deck of cards without jokers. [Hint: all arrays must be declared outside the main method.] Write a method to load the card array, one suit at a time. (Use 11, 12, 13 for Jacks, Queens & Kings, 1 for Aces.) Write a method to print the cards in an array, separating each card by a space and printing each suit on a separate line. Call these two methods from the main method. Compile and test. Write a method that shuffles the deck. To do that this method should get a number between 1 & 51 by multiplying the result of the random function by 50, converting it to an integer and adding 1. Then it should switch each card in the deck with the card that is the given number of cards after it (if there is one). This should be repeated 1000 times to shuffle the deck thoroughly. Call this method from the main method, followed by the method that prints the cards array. Test the application. Declare a rectangular array that represents 4 hands of cards with 5 cards each. Write a method that loads this array by dealing cards from the cards array. Be sure to deal one card at a time to each hand. Write a method that prints the hands, separating the cards in each hand by a space and printing each hand on a separate line. Test the application.

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!