Question: I would like help with question number 4 please. Understanding how to do it will help me with questions number 5, number 6, and number
I would like help with question number 4 please. Understanding how to do it will help me with questions number 5, number 6, and number 7.
4. Modify the statement in the main() method that calls the getDeck() method so it stores the deck in an array list instead of an array.


History Blo import java.util.Arrays; //imported an arraylist (2) import java.util.ArrayList; public class CardDeckApp { - public static void main(String args) { System.out.println("DECK"); String[] deck getDeck () ;) : 1 displayCards (deck); System.out.println("SHUFFLED DECK"); shuffle Deck (deck); displayCards (deck); int count = 2; System.out.println("HAND OF " + count + String() hand = dealCards (deck, count); displayCards (hand); " CARDS"); Exercise 12-1 Use an array list This exercise has you modify the Card Deck application of exercise 11-4 so it uses array lists instead of arrays for the deck of cards and the hands. DECK SHUFFLED DECK | Ace of Spades|2 of Spades|3 of Spades4 of Spades.... King of Hearts Jack of Clubs King of Diamonds | 9 of Hearts... FOUR HANDS OF 2 CARDS King of Hearts King of Diamonds Jack of clubs | 3 of Spades | 9 of Hearts 5 of Hearts 18 of clubs Jack of Hearts CARDS LEFT IN DECK: 44 Open the project and add the required import statement 1. Open the project named ch12_exl_Card Deck in the ex_starts directory. Then, review the code for this application and run it to refresh your memory on how it works. 2. Add an import statement to the Card DeckApp file that makes the ArrayList class available. Modify the application to use array lists 3. Modify the declaration for the getDeck() method so it returns an array list of strings instead of an array of strings. Then, modify the code in this method so it stores the cards in an array list instead of an array. When you declare the array list, set its capacity to 52 since that's the maximum number of cards. 4. Modify the statement in the main() method that calls the getDeck() method so it stores the deck in an array list instead of an array. 5. Modify the displayCards() method so it accepts an array list instead of an array. Since the code for this method uses an enhanced for loop, no additional changes are needed. 6. Modify the shuffleDeck() method so it accepts an array list instead of an array. Then, modify the code for this method so it uses the array list. 7. Modify the dealCards() method so it accepts and returns an array list instead of an array. Then, modify the code for this method so it gets and removes the specified number of cards from the deck and adds them to the hand. 8. Delete the import statement for the Arrays class since it's no longer needed. Then, modify the statement in the main() method that calls the dealCards() method so it stores the hand in an array list instead of an array. Test the application to be sure it works like it did before
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
