-
Notifications
You must be signed in to change notification settings - Fork 0
/
java_locales.java
27 lines (20 loc) · 934 Bytes
/
java_locales.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
//Problem: https://www.hackerrank.com/challenges/java-currency-formatter/problem
import java.util.*;
import java.text.*;
public class Solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double payment = scanner.nextDouble();
scanner.close();
// Write your code here.
String us = NumberFormat.getCurrencyInstance().format(payment);
String france = NumberFormat.getCurrencyInstance(Locale.FRANCE).format(payment);
String china = NumberFormat.getCurrencyInstance(Locale.CHINA).format(payment);
Locale in_loc= new Locale("en","in");
String india = NumberFormat.getCurrencyInstance(in_loc).format(payment);
System.out.println("US: " + us);
System.out.println("India: " + india);
System.out.println("China: " + china);
System.out.println("France: " + france);
}
}