-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcurrencychanger.java
More file actions
32 lines (25 loc) · 1.05 KB
/
Copy pathcurrencychanger.java
File metadata and controls
32 lines (25 loc) · 1.05 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
32
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.util.Locale;
public class currencychanger {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double payment = scanner.nextDouble();
scanner.close();
Locale usLocale = Locale.US;
String us = NumberFormat.getCurrencyInstance(usLocale).format(payment);
Locale indiaLocale = new Locale("en", "IN");
String india = NumberFormat.getCurrencyInstance(indiaLocale).format(payment);
Locale chinaLocale = Locale.CHINA;
String china = NumberFormat.getCurrencyInstance(chinaLocale).format(payment);
Locale franceLocale = Locale.FRANCE;
String france = NumberFormat.getCurrencyInstance(franceLocale).format(payment);
System.out.println("US: " + us);
System.out.println("India: " + india);
System.out.println("China: " + china);
System.out.println("France: " + france);
}
}