-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUltimateUeslessDictionary.java
More file actions
38 lines (32 loc) · 1.13 KB
/
Copy pathUltimateUeslessDictionary.java
File metadata and controls
38 lines (32 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package hw3;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
public class ultimateUeslessDictionary {
public static File file = new File("dict.txt");
public static Scanner s = new Scanner(System.in);
public static String word = "";
public static HashMap dict = new HashMap();
public static void main(String[] args) throws IOException {
readFileIntoDict(file,dict);
System.out.println("What are you looking for?");
word = s.next();
//
if (dict.containsKey(word)) {
System.out.println("Okay we have it, but we don't what does it mean either");
} else {
System.out.println("Mis-spelled,why don't you google it?");
}
}
public static void readFileIntoDict(File file,HashMap dict) throws FileNotFoundException {
//here will be completed by my teammate
Scanner reader = new Scanner(file);
for (int i = 0; reader.hasNextLine(); i++) {
dict.put(reader.nextLine(),1);
}
reader.close();
}
}