# 각국 통화 화폐 ## 문제 각국의 통화 화폐가 아래와 같이 존재한다. + KRW: 한국 원화 + USD: 미국 달라 + EUR: 유럽 유로 + JPY: 일본 엔화 아래의 `클래스 다이어그램`을 구현하여 **출력예**와 같은 결과를 얻으시오. ## 클래스 다이어그램 ![Imgur](https://i.imgur.com/qZnjzf4.png) ## 출력 예 ``` KRW: 1500.00 원 USD: 100.50 달라 EUR: 260.87 유로 JPY: 6400.00 엔 ``` ## 뼈대코드 ``` 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[] currencies = { krw, usd, eur, jpy }; // 모든 화폐정보를 출력 for (Currency c : currencies) { System.out.println(c.toString()); } } } class KRW { private double amount; // 수량(1000) private String notation; // 표기법(원) public KRW(double amount, String notation) { this.amount = amount; this.notation = notation; } } class USD { private double amount; private String notation; public USD(double amount, String notation) { this.amount = amount; this.notation = notation; } } class EUR { private double amount; private String notation; public EUR(double amount, String notation) { this.amount = amount; this.notation = notation; } } class JPY { private double amount; private String notation; public JPY(double amount, String notation) { this.amount = amount; this.notation = notation; } } ```
관련 강의로 이동

코드: java 1.8

public class Main { public static void main(String[] args) { } }

입력

정답이 궁금하다면? 코드를 제출해보세요!