Костадин обнови решението на 08.10.2015 23:40 (преди около 9 години)
+def convert_to_bgn(value, currency)
+
+ if currency == :usd
+ (value * 1.7408).round(2)
+ elsif currency == :eur
+ (value * 1.9557).round(2)
+ elsif currency == :gbp
+ (value * 2.6415).round(2)
+ elsif currency == :bgn
+ (value * 1).round(2)
+ end
+
+end
+
+def compare_prices(first_value, first_currency, second_value, second_currency)
+ first_price = convert_to_bgn(firstValue, firstCurrency)
+ second_price = convert_to_bgn(secondValue, secondCurrency)
+
+ first_price <=> second_price
+end