Posted by Alan Lord on 11/02/05 16:16
Shaun wrote:
> Hi,
>
> I am trying to create a function that will convert metres to feet and vice
> versa. After searching Google I have found that 1 meters = 3.2808399 feet.
> However if someone enters 10.5 to mean 10 feet and 5 inches this is not the
> same as 10 feet and half a foot as there are 12 inches in a foot!
>
> Is there a standard conversion for this problem?
Make the interface clear (perhaps have separate text boxes for metric or
imperial entry) so that they enter Feet and Inches rather than a decimal
notation, which is not common anyway. Then calculate the total inches,
multiply by 25.4 and divide by 1000.
Of course you also need to handle fractions... Most Americans I believe
(I'm English) would write 10 5/16" for example.
Hope this helps.
Alan
Navigation:
[Reply to this message]
|