You are viewing a single comment's thread. Return to all comments →
public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double payment = scanner.nextDouble(); scanner.close(); Locale ind = new Locale("en","IN","Rs."); // Write your code here. NumberFormat us, india, china, france; us = NumberFormat.getCurrencyInstance(Locale.US); us.setCurrency(Currency.getInstance(Locale.US)); china = NumberFormat.getCurrencyInstance(Locale.CHINA); china.setCurrency(Currency.getInstance(Locale.CHINA)); france = NumberFormat.getCurrencyInstance(Locale.FRANCE); france.setCurrency(Currency.getInstance(Locale.FRANCE)); india = NumberFormat.getCurrencyInstance(ind); india.setCurrency(Currency.getInstance(ind)); 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)); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Java Currency Formatter
You are viewing a single comment's thread. Return to all comments →