Христо обнови решението на 17.10.2016 10:29 (преди около 8 години)
+MELTING_POINT = { 'water' => 0, 'ethanol' => -114, 'gold' => 1064, 'silver' => 961.8, 'copper' => 1085 }
+BOILING_POINT = { 'water' => 100, 'ethanol' => 78.37, 'gold' => 2700, 'silver' => 2162, 'copper' => 2567 }
+
+def convert_between_temperature_units(degrees, from_units, to_units)
+ degrees_in_celsius = convert_to_celsius degrees, from_units
+ convert_from_celsius degrees_in_celsius, to_units
+end
+
+def convert_to_celsius(degrees, from_units)
+ case from_units
+ when 'F'
+ (degrees - 32) / 1.8
+ when 'K'
+ degrees - 273.15
+ else
+ degrees
+ end
+end
+
+def convert_from_celsius(degrees, to_units)
+ case to_units
+ when 'F'
+ degrees * 1.8 + 32
+ when 'K'
+ degrees + 273.15
+ else
+ degrees
+ end
+end
+
+def melting_point_of_substance(substance, units)
+ convert_from_celsius MELTING_POINT[substance], units
+end
+
+def boiling_point_of_substance(substance, units)
+ convert_from_celsius BOILING_POINT[substance], units
+end