Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Dictionary/Dictionary.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Dictionary/out/production/Dictionary/Word.class
Binary file not shown.
18 changes: 18 additions & 0 deletions Dictionary/src/Dictionary.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import java.security.PublicKey;
import java.util.HashMap;
import java.util.Map;

public class Dictionary {
public static Word[] words = new Word[100];
public static int pos = 0;
public void add(Word word) {
words[pos] = word;
pos++;
}
public static void printAllWords() {
System.out.println("No" + " |English" + " |Vietnamese");
for (int i = 0;i < pos; i++) {
System.out.println(i + " |" +words[i].getWord_target() + " |" + words[i].getWord_explain());
}
}
}
7 changes: 7 additions & 0 deletions Dictionary/src/DictionaryCommandline.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import java.util.zip.DeflaterInputStream;

public class DictionaryCommandline {
public static void showAllWords() {
Dictionary.printAllWords();
}
}
24 changes: 24 additions & 0 deletions Dictionary/src/DictionaryManagement.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import java.util.Scanner;

public class DictionaryManagement {
public static void insertFromCommanline() {
System.out.println("English ");
Scanner sc = new Scanner(System.in);
String new_word = sc.nextLine();
System.out.println("Vietnamese");
String new_explain = sc.nextLine();
Word insert_word = new Word(new_word, new_explain);
Dictionary dictionary = new Dictionary();
dictionary.add(insert_word);
}

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("How many do you want to input:");
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
DictionaryManagement.insertFromCommanline();
}
DictionaryCommandline.showAllWords();
}
}
19 changes: 19 additions & 0 deletions Dictionary/src/Word.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
public class Word {
private String word_target; //tu moi
private String word_explain; //nghia

/**
* getter setter.
* @param word_target
*/
public Word(String word_target, String word_explain) {
this.word_target = word_target;
this.word_explain = word_explain;
}
public String getWord_target() {
return word_target;
}
public String getWord_explain() {
return word_explain;
}
}