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.


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");

BufferedReader in = new BufferedReader(new FileReader(args[0]));
int read, lineCount = 0;
String line = "", word = "";
while((line = in.readLine()) != null)...

By purchasing this solution you'll be able to access the following files:

50% discount

$20.00 $10.00
for this solution

or FREE if you
register a new account!

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.

Upload a file
Continue without uploading

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