currency class

6

Click here to load reader

Upload: muthukumaran-subramanian

Post on 26-May-2015

31 views

Category:

Economy & Finance


1 download

DESCRIPTION

introduction to currency class

TRANSCRIPT

Page 1: Currency class

Java.util package

Page 2: Currency class

Currency

Page 3: Currency class

Currency class

● The java.util.Currency class represents a currency.

● Currencies are identified by their ISO 4217 currency codes.

● The class is designed so that there's never more than one Currency instance for any given currency.

● This is the reason behind no public constructor.

Page 4: Currency class

Methods in Currency

Methods Description

String getCurrencyCode() This method gets the ISO 4217 currency code

Int getDefaultFractionDigits() This method gets the default number fo fraction digits used with the currency

Static Currency getInstance(Locale locale)

This method returns the Currency instance fof the country of the given locale

Static Currency getInstance(String currencyCode)

This method returns the currency instance for the given currency code

String getSymbol() This method gets the symbol of this currency for the default locale.

String getSymbol(Locale locale) This method gets the symbol of this currency for the default locale.

String toString() This method reutrns the ISO 4217 currency code of this currency

Page 5: Currency class

Example program for Currency class

Page 6: Currency class

output