# 각국 통화 화폐
정답코드예시에서는 부모클래스에 오버라이딩할 메소드가 작성되지 않은 것 같아요!
예시대로하면 오류가 나는데 맞나요?
#### CODE <a class='btn btn-default' href='/codes/51336'>Link</a>
```
public class Main {
public static void main(String[] args) {
// 객체 생성
KRW krw = new KRW(1500, "원");
USD usd = new USD(100.50, "달러");
EUR eur = new EUR(260.87, "유로");
JPY jpy = new JPY(1400, "엔");
Currency[] currency = {krw, usd, eur, jpy};
for(Currency c : currency){
System.out.println(c.words());
}
}
}
class Currency{
protected double price;
protected String danwe;
Currency(double price, String danwe){
this.price = price;
this.danwe = danwe;
}
String words(){
return "";
}
}
class KRW extends Currency{
KRW(double price, String danwe){
super(price, danwe);
}
String words(){
return String.format("KRW: %.2f %s", price, danwe);
}
}
class USD extends Currency{
USD(double price, String danwe){
super(price, danwe);
}
String words(){
return String.format("USD: %.2f %s", price, danwe);
}
}
class EUR extends Currency{
EUR(double price, String danwe){
super(price, danwe);
}
String words(){
return String.format("EUR: %.2f %s", price, danwe);
}
}
class JPY extends Currency{
JPY(double price, String danwe){
super(price, danwe);
}
String words(){
return String.format("JPY: %.2f %s", price, danwe);
}
}
```
#### INPUT
```
```
#### OUPUT
```
KRW: 1500.00 원
USD: 100.50 달러
EUR: 260.87 유로
JPY: 1400.00 엔
```