-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJavaCurrencyFormatter.java
37 lines (23 loc) · 1.02 KB
/
JavaCurrencyFormatter.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double payment = scanner.nextDouble();
scanner.close();
NumberFormat cf1 = NumberFormat.getCurrencyInstance(new Locale("en", "US"));
NumberFormat cf2 = NumberFormat.getCurrencyInstance(new Locale("sk", "SK"));
NumberFormat cf3 = NumberFormat.getCurrencyInstance(new Locale("zh", "CN"));
NumberFormat formatter = NumberFormat.getCurrencyInstance(new Locale("en", "IN"));
String france= cf2.format(payment);
String india = formatter.format(payment);
// Write your code here.
System.out.println("US: " + cf1.format(payment));
System.out.println("India: " + india);
System.out.println("China: " +cf3.format(payment));
System.out.println("France: " + france);
}
}