The application class to check output for these methods
importjava.util.Scanner;
publicclassRecursiveApp {
publicstaticvoidmain(String[] args) {
Scannerinput = newScanner(System.in);
RecursiveMethodsdemo = newRecursiveMethods();
System.out.println("Enter the example # you would like to test");
System.out.println("Enter 1 for a call to mystery(4)");
System.out.println("Enter 2 for a call to mystery(4,3,5)");
System.out.println("Enter 3 for a call to recur(27)");
System.out.println("Enter 4 for a call to recur(3,2,6)");
System.out.println("Enter 5 for a call to recur(6,8)");
System.out.println("Enter 6 for a call to result(5)");
intexample = input.nextInt();
if (example == 1) {
System.out.println("a call to mystery(4) produces a value of: " + demo.mystery(4));
} elseif (example == 2) {
System.out.println("a call to mystery(4,3,5) produces a value of: " + demo.mystery(4, 3, 5));
} elseif (example == 3) {
System.out.println("a call to recur(27) produces a value of: " + demo.recur(27));
} elseif (example == 4) {
System.out.println("a call to recur(3,2,6) produces a value of: " + demo.recur(3, 2, 6));
} elseif (example == 5) {
System.out.println("a call to recur(6,8) produces a value of: " + demo.recur(6, 8));
} elseif (example == 6) {
System.out.println("a call to result(5) produces a value of: " + demo.result(5));
} else {
System.out.println("invalid input");
}
}
}