      PROGRAM PGM02
***********************************************************
*    PROGRAMMER: B. Alex Bridges
*    CLASS:      9:00AM
*    PROGRAM:    PGM02.F
*    DUE DATE:   01/21/99
*
* Program Description:
*    This programs reads and prints the user's name as well 
*    as keeps a count of the test runs.
*    It also calculates the amount of current, given 
*    the resistance of three resistors and the applied 
*    voltage.
* Variables:
*    COUNT  : the number of test runs
*    NAMEF  : the user's first name
*    NAMEL  : the user's last name
*    VOLTS  : the applied voltage
*    R1     : the resistance for resistor #1
*    R2     : the resistance for resistor #2
*    R3     : the resistance for resistor #3
*    RT     : the resistance for the combined resistors
*    AMPS   : the resulting current
* Input     : NAMEF,NAMEL,VOLTS,R1,R2,R3
*   NOTE: the value 999 for VOLTS will terminate the program . . . 
* Output    : COUNT,RT,AMPS
***********************************************************
        INTEGER COUNT
        CHARACTER*5 NAMEF,NAMEL*7
	REAL VOLTS,R1,R2,R3,RT,AMPS

* read in values for NAMEF,NAMEL
        PRINT *, 'Enter your first and last name'
        READ *, NAMEF,NAMEL
        PRINT *

* increment the number of test runs
10      COUNT = COUNT + 1

* read in values for VOLTS
	PRINT *, 'Enter 999 to terminate the program -OR- '
	PRINT *, 'Enter the applied voltage'
	READ *, VOLTS
	IF (VOLTS. EQ. 999) GOTO 20

* read in values for R1,R2,R3
        PRINT *, 'Enter the three resistances'
        READ *, R1, R2, R3
        PRINT *

* compute the total resistance for the combined resistors
        RT = ((R1 ** -1.0) + (R2 ** -1.0) + (R3 ** -1.0)) ** -1.0

* compute the resulting current
        AMPS = VOLTS / RT

* display the output
        PRINT *, 'TEST RUN #', COUNT
        PRINT *, 'NAME:  ', NAMEF, NAMEL
        PRINT *, 'RESISTANCE INPUT DATA:  ', R1, ', ', R2, ', ', R3,
     1 ' ohms'
        PRINT *, 'VOLTAGE INPUT DATA:  ', VOLTS, ' volts'
        PRINT *, 'RESULTING CURRENT:  ', AMPS, ' amps'
        PRINT *
	GOTO 10

* print end of program message
20	PRINT *, 'End of program - PGM02.F'
	END
