-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
=
committed
Jul 22, 2020
1 parent
d53bdb7
commit 7663d74
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
Java/01. Introduction/13. Java Currency Formatter/Solution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Problem: https://www.hackerrank.com/challenges/java-currency-formatter | ||
// Difficulty: Easy | ||
// Score: 15 | ||
|
||
|
||
import java.text.NumberFormat; | ||
import java.util.Locale; | ||
import java.util.Scanner; | ||
|
||
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. | ||
System.out.println("US: " + NumberFormat.getCurrencyInstance(Locale.US).format(payment)); | ||
System.out.println("India: " + NumberFormat.getCurrencyInstance(new Locale("en", "IN")).format(payment)); | ||
System.out.println("China: " + NumberFormat.getCurrencyInstance(Locale.CHINA).format(payment)); | ||
System.out.println("France: " + NumberFormat.getCurrencyInstance(Locale.FRANCE).format(payment)); | ||
|
||
} | ||
} |