Question: PLEASE MAKE FOR JAVA In this activity, you will simulate a deck of cards using an array of size 52. Use these hints to guide
PLEASE MAKE FOR JAVA
In this activity, you will simulate a deck of cards using an array of size 52. Use these hints to guide you:
1.The array will need to be of a String data type, and will hold values such as Queen of Hearts, King of Spades, 4 of Clubs, Ace of Diamonds, etc
2.You will need to run a nested for loop: one loop to determine suits, and one loop for numbers (Ace, Jack, Queen, and King included). If it gets confusing or values become hard to keep track of, try illustrating it yourself in your notebook.
3.Since you are using for loops to determine the cards value, what additional variable can you create to keep track of the incrementing index position of the array? You cant save each new card in the same position every time. Remember running totals and/or counters and how this can be applied.
4.Use proper conditional statements within your loops to determine the cards value. You will probably need more than one, considering both suit and value must be determined.
Dont forget to include proper input and output to test this, such as displaying each card and/or allowing the user to display the element at a specific index.
part 2 Shuffling The Deck
You will use your code from Activity 4 for this Activity as well. Write a static method in the class that will take the original deck (the array) and return a shuffled deck. Before worrying about the return type, think about how arrays as parameters work. In order to shuffle, generate two random numbers between 0 and 51, and then swap the elements of those two index positions (the two random numbers). Do this at least 100 times to shuffle thoroughly.
Back in the main method, display the decks both before and after the method is called to make sure that the shuffling worked correctly.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
