I have a spell check program that has these containing words:
Mary had a little lambb
Its fleece was white as ssnow
And everywhere that Mary wentt
The lamb was sure to ggo
The lambb
, snnow
wentt
and ggo
are purposely spelled like that.
I have written code that prints out the words that ARE found in the dictionary but cannot figure how to print out the words that AREN'T found.
Here is my code so far:
package testDelimeter;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
public class test {
public static void main(String[] args) throws FileNotFoundException {
ArrayList<String> dict = new ArrayList<String>();
File inFile = new File(
"C:\\Users\\Ceri\\workspace1\\testDelimeter\\src\\testDelimeter\\"
+ "dict" + ".txt");
Scanner in = new Scanner(inFile);
File text = new File(
"C:\\Users\\Ceri\\workspace1\\testDelimeter\\src\\testDelimeter\\"
+ "text" + ".txt");
Scanner s = new Scanner(text);
while(in.hasNext()){
dict.add(in.next());
}
while(s.hasNext()){
String temp = s.next();
for(int i = 0; i < dict.size(); i++){
if(temp.equalsIgnoreCase(dict.get(i))){
System.out.println(dict.get(i) + temp);
}
}
}
}
}