You are on page 1of 1

static int currencies = 6; // 0-6 ie 7 currencies in use.

static double [][] convertingArray = {


{ // others to United Kingdom Pound:
1.0000, 0.5066, 0.7558, 0.004748, 0.4670, 0.5128, 0.1019 },
{ // others to Canadian Dollar
1.9728, 1.0000, 1.4913, 0.009369, 0.9215, 1.0117, 0.2010 },
{ // others to Euro
1.3228, 0.6703, 1.0000, 0.006282, 0.6179, 0.6784, 0.1342 },
{ // others to Japanese Yen
210.542, 106.684, 159.157, 1.0000, 98.3418, 107.972, 21.4524 },
{ // others to Swiss Franc
2.1406, 1.0846, 1.6181, 0.010166, 1.0000, 1.0977, 0.2181 },
{ // others to US Dollar
1.9499, 0.9881, 1.4740, 0.009260, 0.9108, 1.0000, 0.1987 },
{ // others to Danish Krone
9.8092, 4.9706, 7.4535, 0.04658, 4.5818, 5.0306, 1.0000 },
};
public static double convert(int source, int target, double value ) { do
uble result = -1; if ( source >= 0 &&
source <= currencies && target >= 0 && target <= currencies){
result = convertingArray[target][source] * value;
}
return result;
}

You might also like