Class Exponent

java.lang.Object
  extended by Exponent

public class Exponent
extends java.lang.Object

A class whose methods implement a recursive solution to the power of a base number for a given exponent.

Version:
SCCC West - Copyright (c) 2009
Author:
Carl B. Struck

Constructor Summary
Exponent()
           
 
Method Summary
static void main(java.lang.String[] args)
          The main() method where execution of the class application begins.
static int power(int base, int exponent)
           
 void start()
          Gets an integer for base and exponent from the console, passes them to method power() and displays the resulting power of the base to a showMessageDialog().
 
Methods inherited from class
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Exponent

public Exponent()
Method Detail

main

public static void main(java.lang.String[] args)
The main() method where execution of the class application begins.

Parameters:
args - the String[] array command line parameter

power

public static int power(int base,
                        int exponent)
                 throws NegativeIntegerException
Throws:
NegativeIntegerException

start

public void start()
Gets an integer for base and exponent from the console, passes them to method power() and displays the resulting power of the base to a showMessageDialog().

Throws:
java.lang.NumberFormatException - if user enters non-integer input for 'exponent'
java.lang.Exception - when any unexpected exception occurs