QuestionQuestion

Data Structures
In this assignment, you will write a spell-checker for text files. Your program should take a file name as a command-line argument and check the file for any misspelled words. If a word is misspelled, the program should output a line number and line containing the word and highlight the word by printing a sequence of carets (‘^’) underneath it on the next line.
Your program should consider any sequence of one or more letters separated by whitespace or punctuation a word. Do not attempt to handle words with apostrophes or other intra-word accents correctly: e.g. “you’re” should scan as “you” and “re”. The Character class has a method isLetter which you can use to determine whether a char is a letter in the alphabet.
The file words.txt contains a list of valid words. Use this file as your dictionary. For each word in the input file, scan through words.txt until a matching word is found; if no matching word is found, consider the word misspelled.
See below for words.txt

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;


public class SpellChecker {
public static void main(String[] args)
{
if(args.length != 1)
{
System.out.println("Please enter in the filename of document to check");
System.exit(0);
}

try{
BufferedReader in = new BufferedReader(new FileReader(args[0]));
int read, lineCount = 0;
String line = "", word = "";
while((line = in.readLine()) != null)...
$20.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats