import java.util.*;
class Dictionary
{
private static String [] kor = {"사랑", "아기", "돈", "미래", "희망"};
private static String [] eng = {"love","baby","money","future","hope"};
public static void kor2eng(String word)
{
for(int i=0; i<5; i++)
{
if(kor[i].equals(word))
{
System.out.printf("%s은 %s\n", word, eng[i]);
return;
}
}
System.out.printf("%s란 단어는 사전에 없습니다\n", word);
return;
}
}
public class Main{
public static void main(String[] args){
String stop = "그만";
Scanner t = new Scanner(System.in);
System.out.println("한영 단어 검색 프로그램.");
while(true){
System.out.print("한글 단어 >> ");
String word = t.next();
if(word.equals(stop)){
return;
}
else{
Dictionary.kor2eng(word);
}
}
}
}
* 클래스의 구성요소
속성 - 필드
기능 - 메소드
초기값 - 생성자
*/
//class Person{
// private String name;
// int age;
// String school;
// public void setName(String name) {
// this.name=name;
// }
//}
//
//class Student extends Person{
// char grade;
//}
//
//class Teacher extends Person{
// String subject;
//}
//
//class El_Student extends Student{
//
//}
//
//class Main{
// public static void main(String[] args) {
// Person p = new Person();
// //p.name= "현수";
// p.setName("현수");
//
// }
//}
//class point{
// private int x,y;
// public void set(int x, int y) {this.x = x; this.y = y;}
// public void showpoint() {System.out.printf("(%d, %d)\n", x, y);}
// }
//class colorpoint extends point{
// private String color;
// public void setColor(String color) {this.color = color;}
// public void showcolorpoint() {System.out.print(color); showpoint();}
// }
//public class Main{
// public static void main(String[] args) {
// point p = new point();
// p.set(1, 2);
// p.showpoint();
//
// colorpoint cp = new colorpoint();
// cp.set(3, 4);
// cp.setColor("red");
// cp.showcolorpoint();
// }
//}
/*
class Pen{
private int amount;
public void setAmount(int amount) {this.amount = amount;}
public int getAmount() {return amount;}
}
class SharpPencil extends Pen{
private int width;
}
class Ballpen extends Pen{
private String color;
public void setColor(String color) {this.color = color;}
public String getColor(String color) {return color;}
}
class Fountainpen extends Ballpen{
public void refill(int n) {
setAmount(n);
}
}
public class Main{
public static void main(String[] args) {
SharpPencil sp = new SharpPencil();
Ballpen bp = new Ballpen();
Fountainpen ft = new Fountainpen();
}
}
*/
//class Person {
// private String name;
// int age;
// String school;
// public Person() {
// System.out.println("갑자기 이게 실행된다고?");
// }
//
// public Person(int age) {
// this.age=age;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//}
//
//class Student extends Person {
// char grade;
// public Student() {
// super();
// System.out.println("student의 생성자");
// }
// public Student(int age) {
// super(age);
// }
//}
//
//public class Main {
// public static void main(String[] args) {
// //Person p = new Person(50);
// Student s = new Student(50);
// }
//}
//class TV{
// private int size;
// public TV(int size) {this.size = size;}
// protected int getsize() {return size;}
//}
//
//class ColorTV extends TV{
// int c;
// public ColorTV(int size, int color)
// {
// super(size);
// c = color;
// }
// public void printProperty() {
// System.out.print(getsize()+"인치 "+c+"컬러");
// }
//}
//public class Main{
// public static void main(String[] args) {
// ColorTV myTV = new ColorTV(32, 1024);
// myTV.printProperty();
// }
//}