All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.roguewave.money.currency.v1_0.DivisionExchange

java.lang.Object
   |
   +----com.roguewave.money.currency.v1_0.Exchange
           |
           +----com.roguewave.money.currency.v1_0.BilateralExchange
                   |
                   +----com.roguewave.money.currency.v1_0.DivisionExchange

public class DivisionExchange
extends BilateralExchange
The DivisionExchange derives from the abstract base class BilateralExchange. A DivisionExchange object converts a source currency to a target currency by dividing the amount of the source currency by the associated conversion factor to obtain the target currency. This contrasts with MultiplicationExchange which multiplies its source currency by the conversion factor to obtain the target amount.

Author:
Trevor Misfeldt
See Also:
BilateralExchange, Exchange, MultiplicationExchange, FactoryExample, GroupExample

Variable Index

 o NAME
The name of this method of conversion is "Bilateral Division"

Constructor Index

 o DivisionExchange(ExchangeRate)
Creates a new exchange object with the source, target and factor taken from the exchange rate.
 o DivisionExchange(String, String, double)
Creates a new exchange object with the desired source, target and conversion factor.

Method Index

 o exchange(Money)
Exchanges the money to the target currency.

Variables

 o NAME
 public static final String NAME
The name of this method of conversion is "Bilateral Division"

Constructors

 o DivisionExchange
 public DivisionExchange(ExchangeRate rate)
Creates a new exchange object with the source, target and factor taken from the exchange rate.

Parameters:
rate - the exchange rate to use for conversion
 o DivisionExchange
 public DivisionExchange(String source,
                         String target,
                         double factor)
Creates a new exchange object with the desired source, target and conversion factor.

Parameters:
source - the currency to convert
target - the desired currency
factor - the factor to divide the source amount by to get a target amount

Methods

 o exchange
 public Money exchange(Money money)
Exchanges the money to the target currency. Calls the error handler if money's currency is not equal to the source currency.

Parameters:
money - the money before conversion
Returns:
Money in the target currency with a converted value.
Overrides:
exchange in class Exchange

All Packages  Class Hierarchy  This Package  Previous  Next  Index