please do this question in Java .
and you can create any words for the wordlist.txt
You are required to create a simple spell checker program.
There is a list of valid words in a file calledwordlist.txt. The first line of the filecontains a single number that indicates the number of words in thefile. The remainder of the file consists of one word per line.
Your group must write a program that first reads all the wordsfrom the file into a hash table. The program must then present amenu allowing the options indicated below.
Create a main program with the following menu options:
1: Add new word
2: Delete word
3: Check sentence
4: Exit
Menu Option
Description of actions
Add new word
Prompts the user to enter a word.
Adds the new word to the hash table if it does not existalready.
Delete word
Prompts the user to enter a word.
Deletes the word from the hash table if it exists.
Check sentence
Prompts the user to enter a sentence.
Prints a list of all words that do not match values in the hashtable.
Exit
Exits the application
Hash Table design specifications:
Helpful Code snippets:
import java.io.*;
import java.util.*;
public class DataStructuresAssignment2_spellcheck {
public static void main(String[] args) throwsException {
Scanner sc= newScanner(System.in);
File in = newFile("wordList.txt");
BufferedReader br =new BufferedReader(new FileReader(in));
String line=br.readLine(); // this reads a line from the file
st =sc.nextLine(); //This reads a line from the keyboard
StringTokenizer stok= new StringTokenizer(st);
while(stok.hasMoreTokens()){
word = stok.nextToken();
…………………………..
}
}
Note:
You can use a StringTokenizer object from java.util.* to break astring up into its tokens (individual words)
please do this question in Java . and you can create any words for the wordlist.txt You are required to create a simple
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am