public class RecursionPowerFactorial { public static void main (String [] args ) { int base = 3; int exponent = 4; System.out.println(base + " to the " + exponent + " power is " + power(base, exponent)); System .out. println ("The factorial of " + base + " is: " + factorial(base)); } // precondition: 0 <= base public static int factorial(int base) { if (base != 0) { return (base * factorial (base - 1)); } else { return 1; } } // precondition: 0 <= exponent public static int power (int base, int exponent) { if (exponent != 0) { return (base * power(base, exponent - 1)); } else { return 1; } } }