isEmpty: false Activity 3: Adding a Shuffle Method to the Deck Class Complete the class by implementing the method. Deck shuffle() Below is the algorithm you must use: Given a deck of size n with indexes from 0 to n-1 For k = n-1 down to 1, Generate a random integer r between 0 and k, inclusive; Exchange cards[k] and cards[r]. Run again. The deck should now be shuffled - perhaps like the output DeckTester below, but it is random - so it will likely be different! size = 6 jack of clubs (point value = 11) king of clubs (point value = 13) queen of clubs (point value = 12) queen of hearts (point value = 12) king of hearts (point value = 13) jack of hearts value = 11) isEmpty: false Activity 4: Implementing the Elevens Start by reading over the code in the abstract class. is abstract because it Board Board has one or more abstract methods. Recall that have all abstract methods. Neither interfaces interfaces of abstract class can be instantiated. Now look at the code. You need to complete 4 methods in this class. ElevensBoard Start by completing the helper methods. These methods will be called ElevensBoard only by other methods within the class, which is why they are private. ElevensBoard boolean containsPairSum11(List<Integer> cardIndexes)
isEmpty: false Activity 3: Adding a Shuffle Method to the Deck Class Complete the Deck class by implementing the shuffle() method. Below is the algorithm you must use: Given a deck of size n with indexes from 0 to n-1 For k = n-1 down to 1, Generate a random integer r between 0 and k, inclusive; Exchange cards[k] and cards[r]. Run DeckTester again. The deck should now be shuffled - perhaps like the output below, but it is random - so it will likely be different! size = 6 jack of clubs (point value = 11) king of clubs (point value = 13) queen of clubs (point value = 12) queen of hearts (point value = 12) king of hearts (point value = 13) jack of hearts value = 11) isEmpty: false Activity 4: Implementing the Elevens Start by reading over the code in the abstract Board class. Board is abstract because it has one or more abstract methods. Recall that interfaces have all abstract methods. Neither interfaces of abstract class can be instantiated. Now look at the ElevensBoard code. You need to complete 4 methods in this class. Start by completing the ElevensBoard helper methods. These methods will be called only by other methods within the ElevensBoard class, which is why they are private. boolean containsPairSum11(List<Integer> cardIndexes)
Elevens%20Lab%20-%20Haas.docx