I was wondering if I could get some help trying to create a simple math formula. I recently was given an interview to work as a tier1 programmer and was asked to make a program. I made the whole thing perfectly fine but what made me fail the interview was that I need to create a math formula to convert different units of measure to other units of measure. This is easy, but what made it hard was that I needed to convert these different units of measure based off of the lengths given to me in feet. This is really bugging me because the guy said that I could just made one equation that could been used for all of the conversions to the different units of measurement. So, the current units of measurement that were given contained their original units of measurement and their measurement in terms of feet. The formula has to utilize the different lengths in terms of feet to do these conversions. Other wise, I would got the job by just dividing and multiplying everything to get my answer. The different units of measure are as follows:
inch,.083333
fathom,6
foot,1
furlong,660
kilometer,3281.5
meter,3.2815
mile,5280
rod,16.5
yard,3
The numbers after the comma are the lengths in terms of feet for that unit of measure. I have been staring at this for hours, but I cannot figure out an equation to use for all the lengths. For those that give me help, I really do appreciate it, I am beginning to feel defeated with this.
For programing sake, I used X
as the original units of measurement, Y
as the desired units or measurement, and Z
for the inputted length that needed to be converted.