Question: JAVA Programming Scrabble Help: The filedictionary.txtcontains all of the words in the Official Scrabble Player's Dictionary, Second Edition. Note: this list contains some offensive language.

JAVA Programming

Scrabble Help:The filedictionary.txtcontains all of the words in the Official Scrabble Player's Dictionary, Second Edition.Note: this list contains some offensive language.Write a class, WordLists, in Java that generates useful word lists for scrabble players using this list.

Your class should contain the following methods:

  • WordLists(String fileName): a constructor that takes the name of the dictionary file as the only parameter.
  • lengthN(int n): returns an ArrayList of all lengthnwords (Strings) in the dictionary file.
  • endsWith(char lastLetter, int n): returns an ArrayList of words of lengthnending with the letterlastLetter
  • containsLetter(char included, int index, int n): returns an ArrayList of words of lengthncontaining the letterincludedat positionindex. So for example the word "cannon" would be on the list returned by containsLetter('o',6,4) because it contains the letter 'o', at index 4, and is length 6.
  • multiLetter(int m, char included): returns an ArrayList of words with at leastmoccurrences of the letterincluded.

Use the included template for your WordLists.java file. Write your own test class for your WordLists class that tries these methods out and writes the word lists (the ArrayLists of strings) to text files.

What to hand in:

A Template for the WordLists.java file is in the Assignment 5 workspace on Codio. You must create your own test class (separate file with main method) that tests each of your methods and writes the results to a text file. In addition to the source files include a text file named readMe.txt with an explanation of how your program works. That is, write in plain English, instructions for using your software, explanations for how and why you chose to design your code the way you did. The readMe.txt file is also an opportunity for you to get partial credit when certain requirements of the assignment are not met.

import java.util.ArrayList;

public class WordLists{

public WordLists(String fileName){

// your code here

}

public ArrayList lengthN(int n){

// your code here

}

public ArrayList endsWith(char lastLetter, int n){

// your code here

}

public ArrayList containsLetter(char included, int,index, int n){

// your code here

}

public ArrayList multiLetter(int m, char included){

// your code here

}

} // end of class

The dictionary.txt file contains like this:

aa

aah

aahed

aahing

aahs

aal

aalii

aaliis

aals

aardvark

aardvarks

aardwolf

aardwolves

aargh

aas

aasvogel

aasvogels

aba

abaca

abacas

abaci

aback

abacus

abacuses

abaft

abaka

abakas

abalone

abalones

abamp

abampere

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 Programming Questions!