/** * Write a description of class MathExamples here. * * @author John Paxton * @version 1.0 */ public class MathExamples { public static int factorial (int n) { if (n < 0) { System.out.println("Error - the number must not be negative"); return -1; } else { return factorialAux (n); } } private static int factorialAux (int n) { if (n <= 0) { return 1; } else { return n * factorialAux(n - 1); } } public static int fibonacci (int n) { if (n <= 0) { return 0; } else if (n == 1) { return 1; } else { return fibonacci(n - 1) + fibonacci(n - 2); } } }