Currency Formater w.r.t. country

import java.text.*;
import java.util.*;

class CurrencyFormatExample {

public void currencyFormat(Locale currentLocale) {
Double currency = new Double(9843.21);

NumberFormat currencyFormatter;
String currencyOut;

currencyFormatter = NumberFormat.getCurrencyInstance(currentLocale);
currencyOut = currencyFormatter.format(currency);
System.out.println(currencyOut + ” ” + currentLocale.toString()+”\n”);
}

public static void main(String args[]) {
Locale[] locales = new Locale[]{new Locale(“fr”, “FR”), new Locale(“de”, “DE”),
new Locale(“ca”, “CA”), new Locale(“rs”, “RS”), new Locale(“en”, “IN”)
};

CurrencyFormatExample[] formate = new CurrencyFormatExample[locales.length];

for (int i = 0; i < locales.length; i++) {
formate[i] = new CurrencyFormatExample();
formate[i].currencyFormat(locales[i]);
}
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s