From: Matthew Moss Date: 2008-11-15T00:49:26+09:00 Subject: [QUIZ] Unit Conversion (#183) -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- The three rules of Ruby Quiz 2: 1. Please do not post any solutions or spoiler discussion for this quiz until 48 hours have passed from the time on this message. 2. Support Ruby Quiz 2 by submitting ideas as often as you can! Visit . 3. Enjoy! Suggestion: A [QUIZ] in the subject of emails about the problem helps everyone on Ruby Talk follow the discussion. Please reply to the original quiz message, if you can. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ## Unit Conversion (#183) Google added a calculator to its search engine a while back. Enter "convert 50 miles to kilometers", or even just "50 mi to km", and the first "search" result will tell you that 50 miles is 80.4672 kilometers. This works for units other than length. Try "33 ml to gal", "6 hours to minutes", and"50 stones to lbs", and you'll see that Google's calculator knows a lot of different units and how to convert between them all. Your task is to write a units converter script. The input to the script must be three arguments: the quantity, the source units, and the destination units. The first example above would be run like this: $ ruby convert.rb 50 miles kilometers Or, using abbreviations: $ ruby convert.rb 50 mi km Support as many units and categories of units (i.e. volume, length, weight, etc.) as you can, along with appropriate abbreviations for each unit.