- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJavaCurrencyFormatter.java
More file actions
Latest commit
22 lines (18 loc) · 819 Bytes
/
Copy pathJavaCurrencyFormatter.java
File metadata and controls
22 lines (18 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
packageIntroduction;
importjava.util.*;
importjava.text.*;
publicclassJavaCurrencyFormatter {
publicstaticvoidmain(String[] args) {
Scannerscanner = newScanner(System.in);
doublepayment = scanner.nextDouble();
scanner.close();
Stringus = NumberFormat.getCurrencyInstance(Locale.US).format(payment),
india = NumberFormat.getCurrencyInstance(newLocale("en", "in")).format(payment),
china = NumberFormat.getCurrencyInstance(Locale.CHINA).format(payment),
france = NumberFormat.getCurrencyInstance(Locale.FRANCE).format(payment);
System.out.println("US: " + us);
System.out.println("India: " + india);
System.out.println("China: " + china);
System.out.println("France: " + france);
}
}