/**
 *  
 * Class USDCAD takes an amount of money in US dollars 
 * and converts it to Canadian dollars.
 *
 * @author  Daniel Burgner
 * @version 1.0
 * @date    03.05.2002
 *
 */
import java.lang.*;

public class USDCAD implements Conversion {

	/* dUSDCADRate is the conversion rate from US dollars 
	   to Canadian dollars. */
	protected double dUSDCADRate;

	/**
	 * Calculates the result in either US dollars or
	 * Canadian dollars.
	 * @param  dA - The amount of money to be converted.
	 * @param  bF - The flag determining which conversion.
	 * @return the result of the calculation - a double
	 */
	public double result(double dA, boolean bF) {
		if (bF) {
			return (dUSDCADRate * dA);
		} else {
			return ((1.0 / dUSDCADRate) * dA);
		}
	}

	/**
	 * Creates a new USDCAD object that takes in the
	 * coordinates of the conversion rate and a flag
	 * indicating a USD or a CAD currency.
	 * @param dR - the conversion rate.
	 */
	public USDCAD(double dR) {
		dUSDCADRate = dR;
	}
}
