/* 

   ohms - Numerator program to calculate current, voltage, or resistance 
          based on Ohms's law

*/
                                       /* display a simple menu       */
"** Ohm's Law Calculations **\n"
"1) Find current\n"
"2) Find voltage\n"
"3) Find resistance\n"
"   Enter 1 - 3: \n"

                                       /* reject bad choices          */
get choice
if (choice < 1 || choice > 3)
   do "ohms"
endif

                                       /* get information for current */
                                       /* calculation                 */
if (choice == 1)
   "Enter voltage "
   get voltage
   "Enter resistance "
   get resistance
   "Current is "
   current = voltage / resistance
   current:
   " amperes\n"
endif

if (choice == 2)
   "Enter current "
   get current
   "Enter resistance "
   get resistance
   "Voltage is "
   voltage = current * resistance
   voltage:
   " volts\n"
endif

if (choice == 3)
   "Enter current "
   get current
   "Enter voltage "
   get voltage
   "Resistance is "
   resistance = current / voltage
   resistance:
   " ohms\n"
endif

