|
|
@ -1,25 +1,13 @@ |
|
|
|
#include "currencyExchange.h" |
|
|
|
|
|
|
|
float toUSD(float euro) { |
|
|
|
|
|
|
|
float USD = euro * CURRENT_USD_RATE_OF_ONE_EURO; |
|
|
|
|
|
|
|
return USD; |
|
|
|
} |
|
|
|
|
|
|
|
float toGBP(float euro) { |
|
|
|
|
|
|
|
float GBP = euro * CURRENT_GBP_RATE_OF_ONE_EURO; |
|
|
|
|
|
|
|
return GBP; |
|
|
|
} |
|
|
|
|
|
|
|
float convert(float euro, int newCurrencyCode) { |
|
|
|
switch(newCurrencyCode) { |
|
|
|
case 1: |
|
|
|
return ( euro * CURRENT_USD_RATE_OF_ONE_EURO ); |
|
|
|
case 2: |
|
|
|
return ( euro * CURRENT_GBP_RATE_OF_ONE_EURO ); |
|
|
|
case CURRENCY_CODE_USD: |
|
|
|
return ( euro * USD_RATE_OF_ONE_EURO ); |
|
|
|
|
|
|
|
case CURRENCY_CODE_GBP: |
|
|
|
return ( euro * GBP_RATE_OF_ONE_EURO ); |
|
|
|
} |
|
|
|
|
|
|
|
return -1; |
|
|
|
} |