java.lang.Object
public class Fibonacci
A class whose methods implement a recursive solution to the Fibonacci Series.
Constructor Summary | |
---|---|
Fibonacci()
|
Method Summary | |
---|---|
static int |
fibonacci(int n)
A recursive method which calculates and returns a value in the Fibonacci series for a positive integer or zero (0). |
static void |
start()
Gets an integer from the console, passes it to method fibonacci() and displays the resulting Fibonacci series value to the terminal window. |
Methods inherited from class |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Fibonacci()
Method Detail |
---|
public static int fibonacci(int n) throws java.lang.Exception
n
- an int whose Fibonacci Series value is to be calculated
java.lang.Exception
- thrown if the exponent parameter is a negative numberpublic static void start()
java.util.InputMismatchException
- if user enters non-integer input
java.lang.Exception
- if input int
is negative or greater than 40