Source Code : extends CurrencyNameProvider

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

extends CurrencyNameProvider

 

import java.util.Locale;
import java.util.spi.CurrencyNameProvider;

public class CurrencyNameProviderImpl extends CurrencyNameProvider {
  final static Locale[] locales = new Locale[] { new Locale("ti", "ER") };

  public Locale[] getAvailableLocales() {
    return locales;
  }

  public String getSymbol(String currencyCode, Locale locale) {
    if (currencyCode == null || locale == null)
      throw new NullPointerException();

    if (currencyCode.length() != 3)
      throw new IllegalArgumentException("currency code length not 3");

    for (int i = 0; i < 3; i++)
      if (!Character.isUpperCase(currencyCode.charAt(i)))
        throw new IllegalArgumentException("bad currency code");

    if (!locale.equals(locales[0]))
      throw new IllegalArgumentException("unsupported locale");

    if (currencyCode.equals("ERN"))
      return "Nfk";
    else
      return null;
  }
}

 

Thank with us