Browse Source

Refactoring: Remove useless code and update constant names

remotes/origin/feature/currency-exchange
Shivam Chaudhary 2 years ago
parent
commit
2aee8c516b
  1. 24
      src/currencyExchange.c

24
src/currencyExchange.c

@ -1,25 +1,13 @@
#include "currencyExchange.h" #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) { float convert(float euro, int newCurrencyCode) {
switch(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; return -1;
} }
Loading…
Cancel
Save