- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolution.java
More file actions
Latest commit
31 lines (26 loc) · 1.15 KB
/
Copy pathsolution.java
File metadata and controls
31 lines (26 loc) · 1.15 KB
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
// github.com/Utkarsh299-tech
importjava.io.*;
importjava.util.*;
importjava.text.*;
importjava.math.*;
importjava.util.regex.*;
importjava.text.NumberFormat;
importjava.util.Locale;
publicclassSolution {
publicstaticvoidmain(String[] args) {
Scannerscanner = newScanner(System.in);
doublepayment = scanner.nextDouble();
scanner.close();
/* Create custom Locale for India - I used the "IANA Language Subtag Registry" to find India's country code */
LocaleindiaLocale = newLocale("en", "IN");
/* Create NumberFormats using Locales */
NumberFormatus = NumberFormat.getCurrencyInstance(Locale.US);
NumberFormatindia = NumberFormat.getCurrencyInstance(indiaLocale);
NumberFormatchina = NumberFormat.getCurrencyInstance(Locale.CHINA);
NumberFormatfrance = NumberFormat.getCurrencyInstance(Locale.FRANCE);
System.out.println("US: " + us.format(payment));
System.out.println("India: " + india.format(payment));
System.out.println("China: " + china.format(payment));
System.out.println("France: " + france.format(payment));
}
}