I want to make an online measurement converter for my company’s intranet page. I am torn about how to handle the converting and wanted some opinions.
Basically the user would enter some random measurement and select what type of measurement that is and what they want it converted to. For example 12 Inches = 1 Foot or 12 Feet = 365.76 centimeter
Version 1
Do I enter each conversion factor possible?
1 centimeter = 0.03280839895 feet
1 centimeter = 0.3937007874 inch
1 centimeter = 0.01 meter
1 feet = 30.48 centimeter
1 feet = 12 inch
1 feet = 0.3048 meter
and so on.
If this is the case then if I have 10 possible choices then I would have 100 different formulas to hard code.
Version 2
Do I convert what ever number they enter to say centimeters and then convert the centimeters to what ever they wanted outputted to them.
I think this would only be 20 formulas then. Ten to get you to centimeters and 10 to get you back out.
Hopefully that makes sense.
Ken