Question: Java question: /* * WordGame * * beginnings of a Scrabble-like word game * * adds the letter tiles from Scrabble to a bag and

Java question: Java question: /* * WordGame * * beginnings of a Scrabble-like word /* * WordGame * * beginnings of a Scrabble-like word game * * adds the letter tiles from Scrabble to a bag and randomly selects * seven for the user's hand */ public class WordGame { // number of letters in player's hand in Scrabble public static final int LETTERS_PER_TURN = 7; // distribution of Scrabble tiles public static final char [][] ENGLISH_LETTERS = {{'1', 'K', 'J', 'X', 'Q', 'Z'}, {'2', 'B', 'C', 'M', 'P', 'F', 'H', 'V', 'W', 'Y'}, {'3', 'G'}, {'4', 'L', 'S', 'U', 'D'}, {'6', 'N', 'R', 'T'}, {'8', 'O'}, {'9', 'A', 'I'}, {'0', 'E'}}; /* * adds letter tiles to bag according to their distribution */ public static void addLetters(Bag b, char [] [] let) { // cycle through set of letters for (int i = 0; i  let, Bag player) { } public static void main (String [] args) { // add letters to bag Bag letters = new ArrayBag(); addLetters(letters, ENGLISH_LETTERS); // give player seven random letters Bag playerLetters = new LinkedBag(); selectLetters(letters, playerLetters); System.out.println("Your letters are: " + playerLetters); } } 

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 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]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!