QB / QB64 Discussion Forum      Other Subforums, Links and Downloads      Archived Pascal Resources    Search

Respond to this messageReturn to Index
Original Message
  • Changed it just a little. Took out some redundancy but I think you have it working fine...
    • Pete (no login)
      Posted Jan 10, 2007 3:30 PM

      DIM MenuIn AS INTEGER 'Numeric for user main menu input.
      DIM SHARED num AS INTEGER, i%

      MainMenu:
      CLS
      PRINT
      PRINT "What do you want to do."
      PRINT "****************************"
      PRINT "1. Figure double door sizes according to opening size."
      PRINT "2. Figure single door size according to opening size."
      PRINT "3. Figure pieces for barpanel."
      PRINT "4. Convert decimal number to 32nds of an inch."
      PRINT "5. Figure height of drawers in cabinet."
      PRINT "6. Quits the program."
      PRINT
      PRINT "Please press the number of your choice."
      PRINT
      PRINT "(6 will exit the program)"
      PRINT
      LOCATE , , 1: PRINT "What is your selection? ";

      DO
      MenuIn = VAL(INKEY$)
      LOOP UNTIL MenuIn >= 1 AND MenuIn <= 6

      SELECT CASE MenuIn
      CASE 1
      GOSUB DblDoor 'Figure sizes for double doors according to opening size.
      GOSUB FigDoorWidth
      CASE 2
      GOSUB SnglDoor 'Figure size for single door according to opening size.
      GOSUB FigDoorWidth
      CASE 3
      GOSUB Barpnl 'Figure pieces for a bar panel.
      CASE 4
      GOSUB DecFrac 'Convert decimal numbers to fractions.
      CASE 5
      GOSUB FigDraw 'Figures height of drawers for cabinet.
      CASE 6
      GOTO quit 'Quits the program.
      END SELECT

      LOCATE 25, 1
      PRINT "Press Esc to End or Enter to Continue...";
      DO
      b$ = INKEY$
      IF b$ = CHR$(13) THEN EXIT DO
      IF b$ = CHR$(27) THEN GOTO quit
      LOOP
      RUN

      DblDoor:
      CLS
      'Establish variable x for opening width.
      PRINT "Enter all fractional values in decimal format."
      PRINT
      INPUT "Enter width of opening in decimal amount: "; x
      PRINT
      W = (x + .875) / 2
      PRINT "Each Door Width = "; W
      PRINT
      RETURN

      SnglDoor:
      CLS
      'Establish variable x for opening width.
      PRINT "Enter all fractional values in decimal format."
      PRINT
      INPUT "Enter width of opening in decimal amount: "; x
      PRINT
      W = x + 1
      PRINT "Total Door Width = "; W
      PRINT
      RETURN

      Barpnl:
      CLS
      PRINT "Figures all pieces for barpanels."
      PRINT
      PRINT "Enter all fractional values in decimal format."
      PRINT
      INPUT "Enter total length of barpanel: "; L
      b = L - 4.25
      PRINT "Length of bottom rail: "; b
      PRINT
      INPUT "Enter total number of center mulls: "; C
      V = L - (5 + 2.5 * C)
      D = C + 1
      R = (V / D) + .75
      PRINT "Length of each top rail: "; R
      PRINT
      P = R - .313
      PRINT "Width of each panel: "; P
      RETURN

      DecFrac:
      CLS
      INPUT "To convert a number to 32nds, enter it in decimal form: "; N
      PRINT
      F = 32 * N
      PRINT LTRIM$(STR$(F)); "/32"
      RETURN

      FigDoorWidth:
      R = W - 4.25
      PRINT "Rail length: "; R
      P = R - .313
      PRINT
      PRINT "Panel width: "; P
      RETURN

      FigDraw:
      CLS
      'Establish variable x for cabinet height.
      INPUT "Enter total cabinet height: "; x
      PRINT
      INPUT "How many drawers would you like to have in this cabinet: "; D
      PRINT
      T = x - (4.75 + 2 * D)
      H = (T / D) - .5
      PRINT "Total cabinet height is: "; x
      PRINT "Total number of drawers is: "; D
      PRINT "Height of drawer sides is: "; H
      RETURN

      quit:
      CLS
      PRINT "Quits the program."

    Your Name
    Your Email
    (Optional)
    Message Title
    Message Text
    Options Also send responses to my email address
          


     Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement