Activity 2: The Deck Class 1. Complete the implementation of the class by coding each of the following: Deck Deck constructor - The constructor receives three arrays as parameters. The arrays contain the ranks, suits, and point values for each card in the deck. a) The constructor sets ArrayList to a new ArrayList, and then creates the cards specified cards and adds them to the list. For example: if ranks={"jack","queen","king"}; suits={"clubs","hearts"}; pointValues={11,12,13}; The following cards would be added to the ArrayList: [jack,clubs,11],[jack,hearts,11] [queen,clubs,12],[queen,hearts,12], [king,clubs,13], [king,hearts,13], b) Set parameter to the size of which in this example is 6. size cards, c) Shuffle the deck by calling the method. Note that you will not be shuffle implementing the shuffle method until Activity 3. - This method should return true when the size of the deck is 0; isEmpty false otherwise. - This method returns the number of cards in the deck that are left to be dealt. size 2. Test your code by running the main method in the class and check your output. Deck shuffle is not yet implemented size = 6 jack of clubs (point value = 11) jack of hearts (point value = 11) queen of clubs (point value = 12) queen of hearts (point value = 12) king of (point value = 13) king of hearts (point value = 13)
Activity 2: The Deck Class 1. Complete the implementation of the Deck class by coding each of the following: Deck constructor - The constructor receives three arrays as parameters. The arrays contain the ranks, suits, and point values for each card in the deck. a) The constructor sets ArrayList cards to a new ArrayList, and then creates the specified cards and adds them to the list. For example: if ranks={"jack","queen","king"}; suits={"clubs","hearts"}; pointValues={11,12,13}; The following cards would be added to the ArrayList: [jack,clubs,11],[jack,hearts,11] [queen,clubs,12],[queen,hearts,12], [king,clubs,13], [king,hearts,13], b) Set parameter size to the size of cards, which in this example is 6. c) Shuffle the deck by calling the shuffle method. Note that you will not be implementing the shuffle method until Activity 3. isEmpty - This method should return true when the size of the deck is 0; false otherwise. size - This method returns the number of cards in the deck that are left to be dealt. 2. Test your code by running the main method in the Deck class and check your output. shuffle is not yet implemented size = 6 jack of clubs (point value = 11) jack of hearts (point value = 11) queen of clubs (point value = 12) queen of hearts (point value = 12) king of (point value = 13) king of hearts (point value = 13)
Elevens%20Lab%20-%20Haas.docx