[Web+ Bubble Sort | Example Applications ]
Overview
|
This example converts quantities between different units based on conversion factors stored in a database. The first script queries a table containing a list of different types of measurements: distance, speed, area, and so on. It uses the query results to present the user with a select box, and the user chooses which type of unit to convert. The second script has two functions: it prompts the user to enter the quantity and units to convert, and if the user has submitted a quantity and units previously it does the conversion. The script queries the database to find the names of all units of the type the user has specified. It fills two select boxes with the results of this query, so that the user may choose the units to convert to and from. When the user submits a quantity and units, the second script also queries the database to find the appropriate conversion factors. For each unit, the database contains a factor describing how large the unit is relative to other units. For example, the unit 'feet' has a factor 12 times as large as that of the unit 'inches.' To convert a quantity from inches to feet, the script multiplies the given quantity by the 'inches' factor, and divides by the 'feet' factor. |
Implementation File
| File Name | Type | Function |
| UNITCONV.WML | Script | Asks the user which type of units to convert. |
| UNITCONV2.WML | Script | Asks the user which units to convert and, when user chooses, does the conversion. |
|
Unitconv.wml
<webNoOutput> Univconv2.WML
<webNoOutput> |
