One use for removing random items is a word game like Scrabble in which players
ID: 3586224 • Letter: O
Question
One use for removing random items is a word game like Scrabble in which players select seven tiles for their hand. The file WordGame.java contains a method for adding the Scrabble letter tiles to a bag. Implement a method that randomly removes seven letters from the bag and adds them to a player’s hand:
public static void selectLetters(Bag let, Bag player) Each time the program is run, it should pick seven random letters:
Your letters are: [A, N, T, G, I, H, R] Your letters are: [N, D, C, J, T, A, A] Your letters are: [E, I, E, D, T, S, R]
Explanation / Answer
public static void selectLetters(Bag let, Bag player) { Random random = new Random(); for (int i = 0; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.