CLS
DIM choice AS STRING
DIM unit AS SINGLE
DIM inch AS SINGLE
DIM ft AS SINGLE
DIM mi AS SINGLE
DIM oz AS SINGLE
DIM lbs AS SINGLE
DIM cm AS SINGLE
DIM m AS SINGLE
DIM km AS SINGLE
DIM kg AS SINGLE
DIM g AS SINGLE
'american to metric conversions only for opposite units
'inch to cm
inch = 2.54
'ft to m
ft = .305
'mi to km
mi = 1.61
'oz to g
oz = 28.35
'lbs to kg
lbs = .454
'metric to american conversions only for opposite units
'cm to inch
cm = .394
'm to ft
m = 3.28
'km to mi
km = .62
'kg to lbs
kg = 2.2
'g to oz
g = .0353
DO
DO
INPUT "Which would you like to convert ([1] AMERICAN TO METRIC OR [2] METRIC TO AMERICAN)?", choice
LOOP UNTIL choice = "1" OR choice = "2"
IF choice = "1" THEN
DO
INPUT "Which type of measurement ([1] LENGTH, [2] WEIGHT OR [3] BACK)?", choice
LOOP UNTIL choice = "1" OR choice = "2" OR choice = "3"
IF choice = "1" THEN
DO
INPUT "Which unit of length would you like to convert to ([1] INCH TO CENTIMER, [2] FOOT TO METER, [3] MILE TO KILOMETER OR [4] BACK)?", choice
LOOP UNTIL choice = "1" OR choice = "2" OR choice = "3" OR choice = "4"
IF choice = "1" THEN
INPUT "Enter your number:"; unit
unit = unit * inch
PRINT unit; "is how many centimeters are in that many inch(s)"
EXIT DO
END IF
IF choice = "2" THEN
INPUT "Enter your number:"; unit
unit = unit * ft
PRINT unit; "is how many meters are in that many feet"
EXIT DO
END IF
IF choice = "3" THEN
INPUT "Enter your number:"; unit
unit = unit * mi
PRINT unit; "is how many meters are in that many mile(s)"
EXIT DO
END IF
ELSE
IF choice = "2" THEN
DO
INPUT "Which unit of weight would you like to convert to ([1] OUNCE TO GRAM, [2] POUND TO KILOGRAM OR [3] BACK)?", choice
LOOP UNTIL choice = "1" OR choice = "2" OR choice = "3"
IF choice = "1" THEN
INPUT "Enter your number:"; unit
unit = unit * oz
PRINT unit; "is how many grams are in that many ounce(s)"
EXIT DO
END IF
IF choice = "2" THEN
INPUT "Enter your number:"; unit
unit = unit * lbs
PRINT unit; "is how many kilograms are in that many pound(s)"
EXIT DO
END IF
END IF
END IF
ELSE
IF choice = "2" THEN
DO
INPUT "Which type of measurement ([1] LENGTH, [2] WEIGHT OR [3] BACK)?", choice
LOOP UNTIL choice = "1" OR choice = "2" OR choice = "3"
IF choice = "1" THEN
DO
INPUT "Which unit of length would you like to convert to ([1] CENTIMETER TO INCH, [2] METER TO FOOT, [3] KILOMETER TO MILE OR [4] BACK)?", choice
LOOP UNTIL choice = "1" OR choice = "2" OR choice = "3" OR choice = "4"
IF choice = "1" THEN
INPUT "Enter your number:"; unit
unit = unit * cm
PRINT unit; "is how many inches are in that many centimeter(s)"
EXIT DO
END IF
IF choice = "2" THEN
INPUT "Enter your number:"; unit
unit = unit * m
PRINT unit; "is how many feet are in that many meter(s)"
EXIT DO
END IF
IF choice = "3" THEN
INPUT "Enter your number:"; unit
unit = unit * km
PRINT unit; "is how many miles are in that many kilometer(s)"
EXIT DO
END IF
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''MISTAKE (1)
ELSE : REM Corrected - Missing ELSE statement added here.
IF choice = "2" THEN
DO
INPUT "Which unit of weight would you like to convert to ([1] GRAM TO OUNCE, [2] KILOGRAM TO POUND OR [3] BACK)?", choice
LOOP UNTIL choice = "1" OR choice = "2" OR choice = "3"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''MISTAKE (2)
END IF: REM corrected, you need this END IF here.
IF choice = "1" THEN
INPUT "Enter your number:"; unit
unit = unit * g
PRINT unit; "is how many ounces are in that many gram(s)"
EXIT DO
END IF
IF choice = "2" THEN
INPUT "Enter your number:"; unit
unit = unit * kg
PRINT unit; "is how many pounds are in that many kilogram(s)"
EXIT DO
END IF
END IF
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''MISTAKE (3)
''''''''''''''''''''''''''''''''''''''DO
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''MISTAKE (4 AND 5)
END IF: REM corrected, you need this END IF here.
END IF: REM corrected, you need this END IF here.
LOOP
END