From: snarfy@cruzio.santa-cruz.ca.us
Newsgroups: sci.physics
Subject: Snarfy's ohms law calculator
Keywords: free program for the group
Date: Wed, 29 Jul 92 20:55:27 PDT
Reply-To: snarfy@cruzio.santa-cruz.ca.us


  ____     _     __   __       ?    ``The shadow of that Hyddeous Strength
 <___ /\  / \   /__\ /__ \__/ /|\     Sax Myle and more it is of length.''
 ___//  \/ --\ /  \ /      / / | \    Sir David Lindsay from *Ane Dialog*,
[_________________________/ /  |  \   describing the Tower of Babel.

(..netcom!cruzio!snarfy)
                                7/29/92

   Dear Physics/Electronics Fans-

    The following is a GW-Basic program that can be  used  to  calculate
   amps  ,  ohms  ,  volts  or  watts  given any two knowns to find  any
   one  unknown.  I  orote this program for my  own use about a year ago
   since I couldn't find anything similar in the public domain.  I  hope
   you all like it and find it as useful as I have. If you encounter any
   problems with it please let me know. As far as I know it is bug free-
   but it's never been beta tested by anyone besides myself.

    Thanks to all you high powered  physicists  for  your  comments  and
   criticisms  of ``Street  Sheet  Tech  Briefs''. Your input  , whether
   favorable or not ,is greatly appreciated.

   Regards ,

   snarfy (Jim Ostrowski)

   P.S. You can load this directly into Basic if you  remove  this  note
   with a word processor.


--------------------DELETE THIS LINE AND ABOVE--------------------------


10 PRINT "OHMS LAW CALCULATOR.."
20 NV$="NOT A VALID SELECTION,TRY AGAIN:"
30 GOTO 100
50 PRINT "DO YOU WANT TO DO ANOTHER CALCULATION? Y/N "
55 INPUT Q$
60 IF Q$="y" THEN 100
65 IF Q$="Y" THEN 100
70 STOP
100 PRINT "SELECT VALUE YOU WANT TO DETERMINE:"
200 PRINT "1.OHMS"
300 PRINT "2.AMPS"
400 PRINT "3.VOLTS"
500 PRINT "4.WATTS"
600 INPUT S
700 IF S<1 THEN 850
800 IF S>4 THEN 850
810 IF S=1 THEN 1000
820 IF S=2 THEN 2000
830 IF S=3 THEN 3000
840 IF S=4 THEN 4000
850 CLS
865 PRINT NV$
870 GOTO 100
1000 REM OHMS
1010 PRINT "SELECT FOR VALUES YOU ALREADY HAVE:"
1020 PRINT "1.VOLTS AND AMPS"
1030 PRINT "2.WATTS AND VOLTS"
1040 PRINT "3.WATTS AND AMPS"
1050 INPUT T
1060 IF T=1 THEN 1100
1070 IF T=2 THEN 1200
1080 IF T=3 THEN 1300
1090 CLS
1093 PRINT NV$
1097 GOTO 1010
1100 CLS
1110 INPUT "VOLTS=";A
1120 INPUT "AMPS=";B
1130 GOSUB 6010
1140 PRINT "OHMS=";C
1150 GOTO 50
1200 CLS
1210 INPUT "WATTS=";A
1220 INPUT "VOLTS=";B
1230 GOSUB 6050
1240 PRINT "OHMS=";C
1250 GOTO 50
1300 CLS
1310 INPUT "WATTS=";A
1320 INPUT "AMPS=";B
1330 GOSUB 6100
1340 PRINT "OHMS=";C
1350 GOTO 50
2000 PRINT "SELECT FOR VALUES YOU ALREADY HAVE.."
2010 PRINT "1.VOLTS AND OHMS"
2020 PRINT "2.WATTS AND VOLTS"
2030 PRINT "3.WATTS AND OHMS"
2040 INPUT N
2060 IF N=1 THEN 2100
2070 IF N=2 THEN 2200
2080 IF N=3 THEN 2300
2090 CLS
2093 PRINT NV$
2097 GOTO 2000
2100 CLS
2110 INPUT "VOLTS=";A
2120 INPUT "OHMS=";B
2130 GOSUB 6010
2140 PRINT "AMPS=";C
2150 GOTO 50
2200 INPUT "WATTS";A
2210 INPUT "VOLTS";B
2220 GOSUB 6010
2230 PRINT "AMPS=";C
2240 GOTO 50
2300 INPUT "WATTS=";A
2310 INPUT "OHMS=";B
2320 GOSUB 6150
2330 PRINT "AMPS=";C
2340 GOTO 50
3000 REM VOLTS
3010 PRINT "SELECT VALUES YOU ALREADY HAVE:"
3020 PRINT "1.WATTS AND OHMS"
3030 PRINT "2.WATTS AND AMPS"
3040 PRINT "3.AMPS AND OHMS"
3050 INPUT V
3060 IF V=1 THEN 3100
3065 IF V=2 THEN 3200
3070 IF V=3 THEN 3400
3075 CLS
3080 PRINT NV$
3085 GOTO 3010
3100 INPUT "WATTS=";A
3110 INPUT "OHMS=";B
3120 GOSUB 6170
3130 PRINT "VOLTS=";C
3140 GOTO 50
3200 INPUT "WATTS=";A
3210 INPUT "AMPS=";B
3220 GOSUB 6010
3230 PRINT "VOLTS=";C
3240 GOTO 50
3300 INPUT "AMPS=";A
3310 INPUT "OHMS=";B
3320 GOSUB 6190
3330 GOTO 3230
3400 INPUT "AMPS";A
3410 INPUT "OHMS";B
3420 GOSUB 6190
3430 PRINT "VOLTS=";C
3440 GOTO 50
4000 REM WATTS
4010 PRINT "SELECT THE VALUES YOU ALREADY HAVE:"
4020 PRINT "1.AMPS AND VOLTS"
4030 PRINT "2.AMPS AND OHMS"
4040 PRINT "3.VOLTS AND OHMS"
4050 INPUT W
4060 IF W=1 THEN 4100
4065 IF W=2 THEN 4200
4070 IF W=3 THEN 4300
4075 CLS
4080 PRINT NV$
4085 GOTO 4010
4100 INPUT "AMPS=";A
4110 INPUT "VOLTS=";B
4120 GOSUB 6190
4130 PRINT "WATTS=";C
4140 GOTO 50
4200 INPUT "AMPS=";A
4210 INPUT "OHMS=";B
4220 C=(A*A)*B
4230 PRINT "WATTS = ";C
4240 GOTO 50
4300 INPUT "VOLTS=";B
4310 INPUT "OHMS=";A
4320 GOSUB 6050
4330 PRINT "WATTS=";C
4340 GOTO 50
6010 C=A/B
6020 RETURN
6050 C=(B*B)/A
6060 RETURN
6100 C=A/(B*B)
6110 RETURN
6150 C=SQR(A/B)
6160 RETURN
6170 C=SQR(A*B)
6180 RETURN
6190 C=A*B
6200 RETURN