The QBasic / QB64 Discussion Forum      Other Subforums, Links and Downloads
 
 


  << Previous Topic | Next Topic >>Return to Index  

The Code

December 13 2005 at 12:15 PM
  (Premier Login iorr5t)
Forum Owner

DECLARE SUB Formulas ()
'============================================================================
'****************************************************************************
'*                           Formula Interpolater                           *
'*                                SPH 3U ISP                                *
'*                              By: Craig Vamos                             *
'*                             For: Mr. Greeson                             *
'*                                                                          *
'****************************************************************************
'============================================================================
DECLARE SUB Menu ()
DECLARE SUB MenuPrint ()

DECLARE SUB Options ()
DECLARE SUB Bye ()

DECLARE SUB Kinematics ()
DECLARE SUB K1 ()
DECLARE SUB K2 ()
DECLARE SUB K3 ()
DECLARE SUB K4 ()
DECLARE SUB K5 ()
DECLARE SUB K6 ()
DECLARE SUB K7 ()
DECLARE SUB K8 ()

DECLARE SUB Dynamics ()

DECLARE SUB Light ()


DECLARE SUB WorkEnergyHeatPower ()


DECLARE SUB VibrationsWavesSound ()


DECLARE SUB ElectricityMagnetism ()

CLS

CALL Menu


SUB Bye

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 6, 37: PRINT "Bye!!"

END

END SUB

SUB DY1

END SUB

SUB DY2

END SUB

SUB DY3
END SUB

SUB DY4

END SUB

SUB DY5

END SUB

SUB Dynamics

END SUB

SUB E1
END SUB

SUB E2
END SUB

SUB E3
END SUB

SUB E4
END SUB

SUB E5
END SUB

SUB E6
END SUB

SUB E7
END SUB

SUB E8
END SUB

SUB E9

END SUB

SUB ElectricityMagnetism

END SUB

SUB Formulas

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 5, 35: PRINT "Formulas"

LOCATE 7, 1: PRINT "Kinematics"
LOCATE 9, 1: PRINT "1. "














END SUB

SUB K1

startk1:

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 5, 21: PRINT "Kinematics Formula: 1.  Vav = D / T"


LOCATE 8, 34: PRINT "Variables"
LOCATE 10, 36: PRINT "1. Vav"
LOCATE 11, 36: PRINT "2. D"
LOCATE 12, 36: PRINT "3. T"

LOCATE 14, 20: PRINT "Please Select The Unknown Variable"
LOCATE 15, 13: INPUT "Or Press 0 To Return to The Kinematics Menu --> ", var

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 5, 21: PRINT "Kinematics Formula: 1.  Vav = D / T"

IF var = 1 THEN
    LOCATE 8, 27: INPUT "D, Delta Distance Is"; D
    LOCATE 9, 31: INPUT "T, Delta Time Is"; T
    Vav = D / T
  ELSEIF var = 2 THEN
    LOCATE 8, 27: INPUT "Vav, Average Speed Is"; Vav
    LOCATE 9, 31: INPUT "T, Delta Time Is"; T
    D = Vav * T
  ELSEIF var = 3 THEN
    LOCATE 8, 27: INPUT "Vav, Average Speed Is"; Vav
    LOCATE 9, 27: INPUT "D, Delta Distance Is"; D
    T = D / Vav
  ELSE
    LOCATE 15, 26: PRINT "Please Input A Number From 1 To 3"
      EndTime! = TIMER + 2
      DO
      LOOP WHILE TIMER < EndTime!
    GOTO startk1
END IF

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 5, 21: PRINT "Kinematics Formula: 1.  Vav = D / T"

LOCATE 8, 27: PRINT "Vav, Average Speed is"; Vav
LOCATE 9, 27: PRINT "D, Delta Distance is"; D
LOCATE 10, 31: PRINT "T, Delta Time is"; T


LOCATE 15, 35: PRINT "Options"
LOCATE 17, 26: PRINT "1. Main Menu"
LOCATE 18, 26: PRINT "2. Kinematics Menu"
LOCATE 19, 26: PRINT "3. Input Different Variables"
LOCATE 20, 26: PRINT "4. Exit"

LOCATE 22, 26: INPUT "What Would You Like To Do"; go

IF go = 1 THEN
    CALL Menu
  ELSEIF go = 2 THEN
    CALL Kinematics
  ELSEIF go = 3 THEN
    GOTO startk1
  ELSEIF go = 4 THEN
    CALL Bye
  ELSEIF go = 0 THEN
    CALL Kinematics
  ELSE
    CALL Options
END IF


END SUB

SUB K2

startk2:

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 5, 21: PRINT "Kinematics Formula: 2.  D2 = D1 + VT"

LOCATE 8, 34: PRINT "Variables"
LOCATE 10, 36: PRINT "1. D2"
LOCATE 11, 36: PRINT "2. D1"
LOCATE 12, 36: PRINT "3. V"
LOCATE 13, 36: PRINT "4. T"

LOCATE 15, 20: INPUT "Please Select The Unknown Variable --> ", var

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 5, 21: PRINT "Kinematics Formula: 2.  D2 = D1 + VT"

IF var = 1 THEN
    LOCATE 8, 27: INPUT "D1, Distance One Is"; D1
    LOCATE 9, 32: INPUT "V, Velocity is"; V
    LOCATE 10, 29: INPUT "T, Delta Time is"; T
    D2 = D1 + (V * T)
  ELSEIF var = 2 THEN
    LOCATE 8, 27: INPUT "D2, Distance Two Is"; D2
    LOCATE 9, 32: INPUT "V, Velocity is"; V
    LOCATE 10, 29: INPUT "T, Delta Time is"; T
    D1 = D2 - (V * T)
  ELSEIF var = 3 THEN
    LOCATE 8, 27: INPUT "D2, Distance Two Is"; D2
    LOCATE 9, 27: INPUT "D1, Distance One Is"; D1
    LOCATE 10, 29: INPUT "T, Delta Time is"; T
    V = (D2 - D1) / T
  ELSEIF var = 4 THEN
    LOCATE 8, 27: INPUT "D2, Distance Two Is"; D2
    LOCATE 9, 27: INPUT "D1, Distance One Is"; D1
    LOCATE 10, 32: INPUT "V, Velocity is"; V
    T = (D2 - D1) / V
  ELSE
    LOCATE 15, 26: PRINT "Please Input A Number From 1 to 4"
      EndTime! = TIMER + 2
      DO
      LOOP WHILE TIMER < EndTime!
    GOTO startk2
END IF

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 5, 21: PRINT "Kinematics Formula: 2.  D2 = D1 + VT"

LOCATE 8, 27: PRINT "D2, Distance Two Is"; D2
LOCATE 9, 27: PRINT "D1, Distance One Is"; D1
LOCATE 10, 32: PRINT "V, Velocity Is"; V
LOCATE 11, 29: PRINT "T, Delta Time Is"; T

LOCATE 15, 35: PRINT "Options"
LOCATE 17, 26: PRINT "1. Main Menu"
LOCATE 18, 26: PRINT "2. Kinematics Menu"
LOCATE 19, 26: PRINT "3. Input Different Variables"
LOCATE 20, 26: PRINT "4. Exit"

LOCATE 22, 26: INPUT "What Would You Like To Do"; go

IF go = 1 THEN
    CALL Menu
  ELSEIF go = 2 THEN
    CALL Kinematics
  ELSEIF go = 3 THEN
    GOTO startk2
  ELSEIF go = 4 THEN
    CALL Bye
  ELSEIF go = 0 THEN
    CALL Kinematics
  ELSE
    CALL Options
END IF

END SUB

SUB K3

startk3:

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 5, 21: PRINT "Kinematics Formula: 3.  Aav = V / T"

LOCATE 8, 34: PRINT "Variables"
LOCATE 10, 36: PRINT "1. Aav"
LOCATE 11, 36: PRINT "2. V"
LOCATE 12, 36: PRINT "3. T"

LOCATE 14, 20: PRINT "Please Select The Unknown Variable"
LOCATE 15, 13: INPUT "Or Press 0 To Return to The Kinematics Menu --> ", var

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 5, 21: PRINT "Kinematics Formula: 3.  Aav = V / T"

IF var = 1 THEN
    LOCATE 8, 27: INPUT "V, Delta Velocity Is"; V
    LOCATE 9, 31: INPUT "T, Delta Time Is"; T
    Aav = V / T
  ELSEIF var = 2 THEN
    LOCATE 8, 20: INPUT "Vav, Average Acceleration Is"; Aav
    LOCATE 9, 31: INPUT "T, Delta Time Is"; T
    V = Aav * T
  ELSEIF var = 3 THEN
    LOCATE 8, 20: INPUT "Vav, Average Acceleration Is"; Aav
    LOCATE 9, 27: INPUT "V, Delta Velocity Is"; V
    T = V / Aav
  ELSE
    LOCATE 15, 26: PRINT "Please Input A Number From 1 To 3"
      EndTime! = TIMER + 2
      DO
      LOOP WHILE TIMER < EndTime!
    GOTO startk3
END IF

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 5, 21: PRINT "Kinematics Formula: 3.  Aav = V / T"

LOCATE 8, 20: PRINT "Aav, Average Acceleration is"; Aav
LOCATE 9, 27: PRINT "V, Delta Velocity is"; V
LOCATE 10, 31: PRINT "T, Delta Time is"; T


LOCATE 15, 35: PRINT "Options"
LOCATE 17, 26: PRINT "1. Main Menu"
LOCATE 18, 26: PRINT "2. Kinematics Menu"
LOCATE 19, 26: PRINT "3. Input Different Variables"
LOCATE 20, 26: PRINT "4. Exit"

LOCATE 22, 26: INPUT "What Would You Like To Do"; go

IF go = 1 THEN
    CALL Menu
  ELSEIF go = 2 THEN
    CALL Kinematics
  ELSEIF go = 3 THEN
    GOTO startk3
  ELSEIF go = 4 THEN
    CALL Bye
  ELSEIF go = 0 THEN
    CALL Kinematics
  ELSE
    CALL Options
END IF

END SUB

SUB K4

startk4:

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 5, 21: PRINT "Kinematics Formula: 4.  V2 = V1 + AT"

LOCATE 8, 34: PRINT "Variables"
LOCATE 10, 36: PRINT "1. V2"
LOCATE 11, 36: PRINT "2. V1"
LOCATE 12, 36: PRINT "3. A"
LOCATE 13, 36: PRINT "4. T"

LOCATE 15, 20: INPUT "Please Select The Unknown Variable --> ", var

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 5, 21: PRINT "Kinematics Formula: 4.  V2 = V1 + AT"

IF var = 1 THEN
    LOCATE 8, 27: INPUT "V1, Velocity One Is"; V1
    LOCATE 9, 28: INPUT "A, Acceleration Is"; A
    LOCATE 10, 29: INPUT "T, Delta Time Is"; T
    V2 = V1 + (A * T)
  ELSEIF var = 2 THEN
    LOCATE 8, 27: INPUT "V2, Velocity Two Is"; V2
    LOCATE 9, 28: INPUT "A, Acceleration Is"; A
    LOCATE 10, 29: INPUT "T, Delta Time Is"; T
    V1 = V2 - (A * T)
  ELSEIF var = 3 THEN
    LOCATE 8, 27: INPUT "V2, Velocity Two Is"; V2
    LOCATE 9, 27: INPUT "V1, Velocity One Is"; V1
    LOCATE 10, 29: INPUT "T, Delta Time Is"; T
    A = (V2 - V1) / T
  ELSEIF var = 4 THEN
    LOCATE 8, 27: INPUT "V2, Velocity Two Is"; V2
    LOCATE 9, 27: INPUT "V1, Velocity One Is"; V1
    LOCATE 10, 28: INPUT "A, Acceleration Is"; A
    T = (V2 - V1) / A
  ELSE
    LOCATE 15, 26: PRINT "Please Input A Number From 1 to 4"
      EndTime! = TIMER + 2
      DO
      LOOP WHILE TIMER < EndTime!
    GOTO startk4
END IF

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 5, 21: PRINT "Kinematics Formula: 4.  V2 = V1 + AT"

LOCATE 8, 27: PRINT "V2, Velocity Two Is"; V2
LOCATE 9, 27: PRINT "V1, Velocity One Is"; V1
LOCATE 10, 28: PRINT "A, Acceleration Is"; A
LOCATE 11, 29: PRINT "T, Delta Time Is"; T

LOCATE 15, 35: PRINT "Options"
LOCATE 17, 26: PRINT "1. Main Menu"
LOCATE 18, 26: PRINT "2. Kinematics Menu"
LOCATE 19, 26: PRINT "3. Input Different Variables"
LOCATE 20, 26: PRINT "4. Exit"

LOCATE 22, 26: INPUT "What Would You Like To Do"; go

IF go = 1 THEN
    CALL Menu
  ELSEIF go = 2 THEN
    CALL Kinematics
  ELSEIF go = 3 THEN
    GOTO startk4
  ELSEIF go = 4 THEN
    CALL Bye
  ELSEIF go = 0 THEN
    CALL Kinematics
  ELSE
    CALL Options
END IF

END SUB

SUB K5

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 5, 16: PRINT "Kinematics Formula: 5.  D = V1T + (A/2)(T)^2"

END SUB

SUB K6

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 5, 16: PRINT "Kinematics Formula: 6.  D = V2T - (A/2)(T)^2"

END SUB

SUB K7

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 5, 19: PRINT "Kinematics Formula: 7.  V2^2 = V1^2 + 2AD"

END SUB

SUB K8

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 5, 16: PRINT "Kinematics Formula: 8.  D = [(V1 + V2) / 2]T"


END SUB

SUB Kinematics

startk:

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 6, 30: PRINT "Kinematics Formulas"

LOCATE 8, 30: PRINT "1.  Vav = D / T"
LOCATE 9, 30: PRINT "2.  D2 = D1 + VT"
LOCATE 10, 30: PRINT "3.  Aav = V / T"
LOCATE 11, 30: PRINT "4.  V2 = V1 + AT"
LOCATE 12, 30: PRINT "5.  D = V1T + (A/2)(T)^2"
LOCATE 13, 30: PRINT "6.  D = V2T - (A/2)(T)^2"
LOCATE 14, 30: PRINT "7.  V2^2 = V1^2 + 2AD"
LOCATE 15, 30: PRINT "8.  D = [(V1 + V2) / 2]T"

LOCATE 17, 25: PRINT "Please Select A Formula 1 Through 8,"
LOCATE 18, 22: INPUT "Or Press 0 To Return To The Main Menu --> ", kformula

IF kformula = 0 THEN
     CALL Menu
   ELSEIF kformula = 1 THEN
     CALL K1
   ELSEIF kformula = 2 THEN
     CALL K2
   ELSEIF kformula = 3 THEN
     CALL K3
   ELSEIF kformula = 4 THEN
     CALL K4
   ELSEIF kformula = 5 THEN
     CALL K5
   ELSEIF kformula = 6 THEN
     CALL K6
   ELSEIF kformula = 7 THEN
     CALL K7
   ELSEIF kformula = 8 THEN
     CALL K8
   ELSE
     CLS
     LOCATE 15, 9: PRINT "Please Input A Number From 1 To 8, Or Press 10 For The Main Menu"
       EndTime! = TIMER + 3
       DO
       LOOP WHILE TIMER < EndTime!
    GOTO startk
END IF

END SUB

SUB L1
END SUB

SUB L2
END SUB

SUB L3
END SUB

SUB L4
END SUB

SUB Light

END SUB

SUB Menu

start:

CLS

CALL MenuPrint

LOCATE 17, 22: INPUT "Please Select A Category, 1 Through 8 --> ", category
IF (category = 1) THEN
    CALL Kinematics
  ELSEIF category = 2 THEN
    CALL WorkEnergyHeatPower
  ELSEIF category = 3 THEN
    CALL Dynamics
  ELSEIF category = 4 THEN
    CALL VibrationsWavesSound
  ELSEIF category = 5 THEN
    CALL Light
  ELSEIF category = 6 THEN
    CALL ElectricityMagnetism
  ELSEIF category = 7 THEN
    CALL Formulas
  ELSEIF category = 8 THEN
    CALL Bye
  ELSE
    CLS
    CALL MenuPrint
    LOCATE 15, 26: PRINT "Please Input A Number From 1 to 8"
    EndTime! = TIMER + 2
      DO
      LOOP WHILE TIMER < EndTime!
    GOTO start
END IF

END SUB

SUB MenuPrint

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"

LOCATE 6, 34: PRINT "Categories"
LOCATE 8, 27: PRINT "1. Kinematics"
LOCATE 9, 27: PRINT "2. Work, Energy, Heat, Power"
LOCATE 10, 27: PRINT "3. Dynamics"
LOCATE 11, 27: PRINT "4. Vibrations, Waves, Sound"
LOCATE 12, 27: PRINT "5. Light"
LOCATE 13, 27: PRINT "6. Electricity, Magnetism"
LOCATE 14, 27: PRINT "7. Full List Of Formulas"
LOCATE 15, 27: PRINT "8. Exit"

END SUB

SUB Options

startoptions:

CLS

LOCATE 2, 30: PRINT "Formula Interpolater"
LOCATE 3, 25: PRINT "Works With All SPH 3U Formulas"
LOCATE 6, 35: PRINT "Options"

LOCATE 7, 32: PRINT "1. Main Menu"
LOCATE 8, 32: PRINT "2. Exit"

LOCATE 10, 26: INPUT "What Would You Like To Do"; go

IF go = 1 THEN
    CALL Menu
  ELSEIF go = 2 THEN
    CALL Bye
  ELSE
    GOTO startoptions
END IF

END SUB

SUB V1
END SUB

SUB V2
END SUB

SUB V3
END SUB

SUB V4
END SUB

SUB V5
END SUB

SUB V6
END SUB

SUB V7
END SUB

SUB VibrationsWavesSound

END SUB

SUB W1
END SUB

SUB W2
END SUB

SUB W3
END SUB

SUB W4
END SUB

SUB W5
END SUB

SUB W6
END SUB

SUB W7
END SUB

SUB W8
END SUB

SUB W9
END SUB

SUB WorkEnergyHeatPower

END SUB

 

 Respond to this message   
Current Topic - The Code
  << Previous Topic | Next Topic >>Return to Index  
 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement  

Newbies usually go to www.qbasic.com and click on The QBasic Forum
Forum regulars have their own ways, which include The QBasic Community Forums