-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDictionaryCommandline.java
More file actions
28 lines (26 loc) · 1.01 KB
/
DictionaryCommandline.java
File metadata and controls
28 lines (26 loc) · 1.01 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
import java.io.IOException;
public class DictionaryCommandline extends DictionaryManagement{
public void showAllWords() {
System.out.println("No" + "\t" + "|English" +"\t\t\t\t" + "|Vietnamese");
for (int i =0; i<words.size(); i++)
System.out.println( i+1 + "\t|" + words.get(i).getWord_target()
+"\t\t\t\t|" + words.get(i).getWord_explain());
}
public void dictionaryBasic() {
insertFromCommandline();
showAllWords();
}
public void dictionaryAdvanced(String target) throws IOException {
insertFromFile();
showAllWords();
dictionaryLookup(target);
}
public String[] dictionarySearch(String word) {
String[] search = new String[1000];
for(int i=0; i<words.size(); i++)
if (words.get(i).getWord_target().substring(0,word.length()).equals(word)) {
search[search.length] = words.get(i).getWord_target();
}
return search;
}
}