FRONTIERS IN BIOSCIENCE;
Converters



Length

Millimeters Inches Meter Feet Yards

Weight

Kilograms Pounds

Pressure

Bar Kg/cm Psi

Volume

Liters Fluid
Ounces
Quarts Gallons

Currency

CONVERT

INTO

Length, Mass, Time

This page requires a Java enabled web browser!

Source

Description

This applet is designed to convert between units. The current version supports only units composed of length, mass, and time. In other words temperature, electric, and magnetic units are not yet supported. The program contains a parser which allows complex units to be constructed from the fundemental units of length, mass, and time. As an example the metric unit of power, the watt, can be constructed as follows: kilogram meter^2/second^3.

Instructions

This applet is composed of the following elements:
  • Choice boxes: There are six choice boxes which together contain all of the valid units understood by the applet. The units are grouped by Length, Mass, Time, Volume (Length^3), SI Prefix, and Miscellaneous units. These units can be used to create other units, for example miles/hour. With the exception of kilogram a SI Prefix must be separated from the unit to be modified by an space. A few examples: milli watt, Angstrom/(pico second), and kilo meter/hour.
  • Text fields: The text field labeled Convert is where the input expression to be converted is entered. The expression representing the desired output units should be entered in the text field labeled To. Keyboard input will be directed to the text field with the 'focus'. A text field is said to have the focus if it contains the blinking cursor. Clicking on a text field will give that field the focus, hiting the enter key will togle the focus between the two text fields. In addition to typing in a unit name from the keyboard, units can also be entered by selecting the unit name from a choice box. The unit name will be automatically entered in to the text field with the focus at the currsor position.
  • Convert button: Clicking on the Convert button will cause the applet to convert the expression in the Convert text field to the units expressed in the To field. A separate window is used to display the result of the calculation. In the case of an error an appropriate error message will appear in the window. If the To field is empty the expression in the Convert field will be converted to the base MKS units meter, kilogram, and seconds.
  • Clear buttons: Clicking on the Clear button will erase the text in the text field with the focus.

A Parser is used to interpret the unit expression entered by the user. The parser supports the following operaters: addition +, subtraction -, multiplication *, division /, exponent ^, and parenthesis (). In addition to these operators, the parser will recognize all the units defined in the six choice boxes. The parser is not case sensitive and thus "Angstrom" and "angstrom" are concidered to be the same unit.

There are a few errors that may arise when trying to convert units. Syntax errors result when the parser is unable to interpret a given expression. This may be the result of a misplace or incorrect operator. The following expressions will all generate a syntax error: "meter $ second" - '$' is not a valid operator, "meter second" - there must be a valid operator between two units, "meter^second" - the right side of the exponent operator must be an integer, "(meter/second" - there is no closing parenthesis, and "meter/sec" - the unit "sec" will not be recognized by the parser, it must be spelled out as shown in the time choice box (second). An error will also be generated if the two expressions do not have similar units. For example you can not convert a time to an area.