java.lang.ObjectExponent
public class Exponent
A class whose methods implement a recursive solution to the power of a base number for a given exponent.
| 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 |
|---|
public Exponent()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
args - the String[] array command line parameter
public static int power(int base,
int exponent)
throws NegativeIntegerException
NegativeIntegerExceptionpublic void start()
java.lang.NumberFormatException - if user enters non-integer input for 'exponent'
java.lang.Exception - when any unexpected exception occurs