import structure5.*; class Fib { /* Compute the Fibonacci number for input n. * This allegedly was an early model for the population * growth rate for rabbits (it's not actually true) although * the real model is not all that different. * Note that this would be a *great* opportunity to use * pre- and post- conditions. E.g., astonishingly bad thing * happen when you supply -1 as an input. How could you * prevent such a disaster? */ public static int fibonacci(int n){ if (n == 0) { return 0; } if (n == 1) { return 1; } return fibonacci(n - 1) + fibonacci(n - 2); } public static void main(String[] args) { int n = Integer.valueOf(args[0]); System.out.println(fibonacci(n)); } }