Scrabble Java This Class Represents The Scrabble Game In Which There Are Seven Randomly Selected Tiles And Scoring Is P 1 (99.47 KiB) Viewed 27 times
Scrabble.java This class represents the Scrabble game in which there are seven randomly selected tiles, and scoring is performed for each possible word (this will be the tougher class to implement). The class must have the following private variables: tiles (Tile[]) The class must have the following public methods: public Scrabble() [constructor] o Initialize the Tile array and 'pickup' for random values public Scrabble(Tile []) [constructor] o Initialize the tile array with the given argument public String getLetters() o Return a string that is all of the tile characters (for example, "ABFEODL") public ArrayList<String> getWords() o Create an ArrayList of Strings with n elements. Each element should represent a word that can be created using the current tiles. o The algorithm for this method should reference the provided file CollinsScrabbleWords2019.txt 。 ** do NOT put this file somewhere on your local machine and hardcode the local directory. This will likely cause your tests to fail on GradeScope. Also, do not put it within a folder in the relative path. public int[] getScores() o Create an int array with n elements. Each element in this list should represent each individual score for each word that can be created using the current tiles. This should be returned in ascending order. public Boolean equals(Scrabble) o Compare the given Scrabble object from the argument with the 'this' object to see if they are equal (do they have the same tiles?).
For this assignment, you must implement two java classes: Tile and Scrabble. Follow the guidelines for each one below. In these classes, you can implement more private (helper) methods if you want to. You may not, however implement more public methods. You may not add instance variables other than the ones specified below nor change the variable types or accessibility (i.e. making a variable public when it should be private). Penalties will be applied if you implement additional instance variables or change the variable types of modifiers from what is described here. Tile.java This class represents a single Scrabble tile that will be used in the game. The class must have the following private variables: igation value (char) The class must have the following public methods: public Tile() [constructor] o Initialize value to '' public Tile(char) [constructor] o Initialize value to the given argument public void pickup() o Generate a random character between A and Z (inclusive) and set the value to that letter. o Feel free to use 'java.util.random' for this method public char getValue() o Returns the tile value K<> B HD 90% - nt N di ìl 3E Q
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!