'===========================================================================
' Subject: convert weight length              Date: 07-01-01 (  :  )       
'  Author: Gerald Wykoff                      Code: QB, Qbasic             
'  Origin: wykoff@mbawiz.com                Packet: ALGOR.ABC
'===========================================================================
' Subject: Weight-Length Conversationsc          Date: 7-1-01  
'           Author: Gerald L. Wykoff              Code: QB, QBasic
'           Origin:  wykoff@mbawiz.com
CLS
PRINT
SCREEN 9
COLOR 14, 9
PRINT
PRINT "              CONVERSIONS OF WEIGHT AND LENGTH VALUES"
PRINT
PRINT
COLOR 15
PRINT "         This short utility program enables you to quickly and"
PRINT "     accurately convert weight and length measures. For con-"
PRINT "     venience, calculations for converting troy and avoirdupois"
PRINT "     weights are also included.  You are cautioned to enter"
PRINT "     these systems names precisely as they are spelled: a mis-"
PRINT "     spelling or wrong entry may return you to the start."
PRINT "        Also, if the program fails to make a requested conver-"
PRINT "     sion, chances are you've asked for one that is seldom used"
PRINT "     and is therefore not included here."
PRINT
PRINT
PRINT "                 To continue, tap the spacebar"
DO
 v$ = INKEY$
LOOP UNTIL v$ = " "
PRINT
CLS
150          REM This line does a repeat on the problem
PRINT
CLS
PRINT
PRINT
PRINT
PRINT "     What type of measurement system are you starting with..."
PRINT "             -- carats"
PRINT "                -- grams"
PRINT "                   -- grains"
PRINT "                      --mm"
PRINT "                         --inches"
PRINT "                            --oz.troy"
PRINT "                               --oz.avoir"
PRINT "                                 --lbs.troy"
PRINT "                                   --lbs.avoir"
PRINT "                                      --kilograms"
PRINT "                                          --dwt"
PRINT "                                            --feet"
PRINT "                                              --mommes"
PRINT "                                                 (to grams or taels)"
PRINT
INPUT "   Please spell out one of the above selections"; a$
PRINT
PRINT
PRINT "   In appropriate terms or units, what is the weight or"
INPUT "       length involved in the above measurement selection"; b
PRINT
CLS
PRINT
SELECT CASE a$
  CASE "carats"
     GOTO carats
  CASE "grams"
     GOTO 325
  CASE "grains"
     GOTO 350
  CASE "mm"
     GOTO 375
  CASE "inches"
     GOTO 400
  CASE "oz.troy"
     GOTO 475
  CASE "oz.avoir"
     GOTO 500
  CASE "lbs.troy"
     GOTO 525
  CASE "lbs.avoir"
     GOTO 550
  CASE "dwt"
     GOTO 575
  CASE "kilograms"
     GOTO 585
  CASE "feet"
     GOTO 595
  CASE "mommes"
     GOTO 597
END SELECT
PRINT
REM Lines tags below will contain multipliers for conversion
'
carats:
REM carats to x
INPUT "   To what new system do you wish the above measurement converted"; c$
CLS
SELECT CASE c$
 CASE "grams"
   PRINT
   PRINT
   PRINT
   PRINT "    The equivalent for"; b; a$; " is "; b * .2; c$; "."
  CASE "grains"
   PRINT
   PRINT
   PRINT "    The equivalent for"; b; a$; " is "; b * 3.08; c$; "."
  END SELECT
GOTO 600
'
325
REM grams to x
INPUT "   To what new system do you wish your selection converted"; c$
CLS
SELECT CASE c$
 CASE "carats"
   PRINT
   PRINT
   PRINT "    The equivalent for"; b; a$; " is "; b * 5; c$; "."
  CASE "grains"
   PRINT
   PRINT
   PRINT "    The equivalent for"; b; a$; " is "; b * 14.43; c$; "."
  CASE "oz.avoir"
   PRINT
   PRINT
   PRINT
   PRINT "    The equivalent for"; b; a$; " is "; b * .035; c$; "."
  CASE "oz.troy"
   PRINT
   PRINT
   PRINT "    The equivalent for"; b; a$; " is "; b * .032; c$; "."
  CASE "lbs.avois"
   PRINT
   PRINT
   PRINT
   PRINT "    The equivalent for"; b; a$; " is "; b * .564; c$; "."
  CASE "lbs.troy"
   PRINT
   PRINT
   PRINT "    The equivalent for"; b; a$; " is "; b * .38; c$; "."
END SELECT
GOTO 600
'
350
REM grains to x
INPUT "   To what new system do you wish your selection converted"; c$
CLS
SELECT CASE c$
  CASE "carats"
   PRINT
   PRINT
   PRINT
   PRINT "    The equivalent for"; b; a$; " is "; b * .324; c$; "."
  CASE "grams"
   PRINT
   PRINT
   PRINT
   PRINT "    The equivalent for"; b; a$; " is "; b * .0648; c$; "."
  CASE "oz.avoir"
   PRINT
   PRINT
   PRINT
   PRINT "    The equivalent for"; b; a$; " is "; b * .0023; c$; "."
  CASE "oz.troy"
   PRINT
   PRINT
   PRINT
   PRINT "    The equivalent for"; b; a$; " is "; b * .0021; c$; "."
  CASE "dwt"
   PRINT
   PRINT
   PRINT
   PRINT "    The equivalent for"; b; a$; " is "; b * .0417; c$; "."
  CASE "lbs.avoir"
   PRINT
   PRINT
   PRINT
   PRINT "    The equivalent for"; b; a$; " is "; b * .046; c$; "."
  CASE "lbs.troy"
   PRINT
   PRINT
   PRINT
   PRINT "    The equivalent for"; b; a$; " is "; b * .033; c$; "."
END SELECT
GOTO 600
'
375
REM  (mm) millimeters to x
INPUT "   To what new system do you wish your selection converted"; c$
CLS
SELECT CASE c$
  CASE "inches"
   PRINT
   PRINT
   PRINT
   PRINT "    The equivalent for"; b; a$; " is "; b * .033; c$; "."
  CASE "feet"
   PRINT
   PRINT
   PRINT "    The equivalent for"; b; a$; " is "; b * .003; c$; "."
  END SELECT
GOTO 600
'
400 REM  inches to x
PRINT
PRINT
INPUT "   To what new system do you wish the above measurement converted"; c$
CLS
SELECT CASE c$
  CASE "mm"
    PRINT
    PRINT
    PRINT
    PRINT "    The equivalent for"; b; a$; " is "; b * 25.4; c$; "."
  CASE "feet"
    PRINT
    PRINT
    PRINT
    PRINT "    The equivalent for"; b; a$; " is "; b * .0834; c$; "."
END SELECT
GOTO 600
'
475
REM  oz.troy
INPUT "   To what new measurement system do you want your selection converted"; c$
CLS
SELECT CASE c$
  CASE "grains"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is "; b * 488; c$; "."
  CASE "carats"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is "; b * 155.51; c$; "."
  CASE "grams"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is "; b * 31.1; c$; "."
  CASE "dwt"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is "; b * 20; c$; "."
  CASE "lbs.avoir"
    PRINT "   The equivalent for"; b; a$; " is "; b * .068; c$; "."
END SELECT
GOTO 600
'
597
REM   pearl to x
PRINT "   Be advised that with pearl weights there exits a 'taels' category"
PRINT "   which is a standard, popular Japanese pearl weighing term."
PRINT
PRINT
PRINT
INPUT "   To what new measurement system do you want your selection converted"; c$
CLS
SELECT CASE c$
  CASE "grams"
    PRINT
    PRINT
    PRINT
    PRINT "     The equivalent for"; b; a$; " is"; b * 3.75; c$; "."
  CASE "tael"
    PRINT
    PRINT
    PRINT
    PRINT "     The equivalent for"; b; a$; " is "; b * 10; c$; "."
END SELECT
GOTO 600
'
500  REM  optional calculation for oz.avoir to x
INPUT "   To what new system do you wish the above measurement converted"; c$
CLS
SELECT CASE c$
  CASE "grains"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 437.5; c$; "."
  CASE "grams"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 28.35; c$; "."
  CASE "carats"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is "; b * 141.75; c$; "."

  CASE "lbs.avoir"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b / 16; c$; "."
  CASE "dwt"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; 18.23 * (b / 16); c$; "."
END SELECT
GOTO 600
'
525 REM lbs.troy to x
PRINT
PRINT
INPUT "   To what new system do you wish the above measurement converted"; c$
CLS
SELECT CASE c$
  CASE "grams"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 373.24; c$; "."
  CASE "oz.avoir"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 13.16; c$; "."
  CASE "lbs.avoir"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 9.82; c$; "."
  CASE "dwt"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 240; c$; "."
END SELECT
GOTO 600
'
550 REM lbs.avoir to x
PRINT
PRINT
INPUT "   To what new system do you wish the above measurement converted"; c$
CLS
SELECT CASE c$
  CASE "grains"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 7000; c$; "."
  CASE "grams"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 453.59; c$; "."
  CASE "oz.troy"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 14.58; c$; "."
  CASE "dwt"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 291.67; c$; "."
END SELECT
GOTO 600
'
575 REM dwt to x
INPUT "   To what new system do you wish the above measurement converted"; c$
CLS
SELECT CASE c$
  CASE "grains"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 24; c$; "."
  CASE "grams"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 1.55; c$; "."
  CASE "oz.avoir"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * .054; c$; "."
END SELECT
GOTO 600

585
REM  kilograms to x
INPUT "   To what new system do you wish the above measurement converted"; c$
CLS
SELECT CASE c$
  CASE "dwt"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 643.1; c$; ".   "
  CASE "grams"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 1000; c$; "."
  CASE "oz.avoir"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 35.27; c$; "."
  CASE "oz.troy"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 32.1; c$; "."
  CASE "grains"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 15432.3; c$; "."
  CASE "lbs.avoir"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 2.2; c$; "."
  CASE "lbs.troy"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 2.68; c$; "."
END SELECT
GOTO 600
'
595
REM  feet to
INPUT "   To what new system do you wish the above measurement converted"; c$
CLS
SELECT CASE c$
  CASE "millimeters"
    PRINT
    PRINT
    PRINT
    PRINT "   The equivalent for"; b; a$; " is"; b * 304.8; c$; "."
  CASE "centimeters"
    PRINT
    PRINT
    PRINT
    PRINT "   "
    PRINT "The equivalent for"; b; a$; " is"; b * 30.48; c$; "."
  CASE "inches"
    PRINT
    PRINT
    PRINT
    PRINT "    The equivalent for"; b; a$; " is"; b * 12; c$; "."
END SELECT
GOTO 600
'
'
600 REM Request for Repetition
PRINT
PRINT
PRINT
PRINT
750 PRINT "   To avoid excessively long decimal fractions, some of"
PRINT "   the numbers will be rounded off.  Generally, answers have"
PRINT "   been limited to a maximum of three decimal points, so there"
PRINT "   could be some trivial rounding error especially with the"
PRINT "   larger conversions."
SLEEP 3
PRINT
PRINT
PRINT
INPUT "     Do you wish to work out another conversion problem (y or n)"; e$
IF e$ = "y" GOTO 150 ELSE END
PRINT
END

      SUB carats
CLS


END SUB

SUB momme
END SUB

