We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Java Currency Formatter
Java Currency Formatter
Sort by
recency
|
733 Discussions
|
Please Login in order to post a comment
Doesn't work in Java 15. Currency representation for CHINA doesn't have space between the Yen symbol and the numbers. Tests fail for the same reason. HackerRank needs to fix this issue
try this in Java 8
double payment = scanner.nextDouble(); scanner.close(); String us=NumberFormat.getCurrencyInstance(Locale.US).format(payment); String india=NumberFormat.getCurrencyInstance(new Locale("en","IN")).format(payment); String china=NumberFormat.getCurrencyInstance(Locale.CHINA).format(payment); String france=NumberFormat.getCurrencyInstance(Locale.FRANCE).format(payment);
import java.util.; import java.text.;
public class Solution {
}
I was able to solve this fairly easily but it required online help.