Developpement/23DEV1.1/TPS2/TP01/controle/Monnaie.java

21 lines
559 B
Java
Raw Normal View History

2024-12-09 11:53:11 +01:00
import java.util.Currency;
import java.io.*;
import java.lang.*;
public class Monnaie{
public static void main(String[] args) {
String code = new String();
String symbol = new String();
String num = new String();
code = args[0];
try{
Currency coder = Currency.getInstance(code);
num = coder.getNumericCodeAsString();
symbol = coder.getSymbol();
System.out.println("code numérique : "+ num);
System.out.println("symbole : "+ symbol);
}catch(IllegalArgumentException ie){
System.err.println("Valeur invalide");
}
}
}