Java Recursive Problems
//The driver: public class Hw { public static void main(String[] args) { // TODO code application logic here System.out.println("Checking Hw#3"); System.out.println("==============\n\n"); // check isShaw System.out.println("We check isShaw"); System.out.println("isShaw(\"abbbabb\") is " + isShaw("abbbabb")); System.out.println("isShaw(\"abbbaca\") is " + isShaw("abbbaca")); System.out.println("isShaw(\"abbbabbaabbbabb\") is " + isShaw("abbbabbaabbbabb")); System.out.println("isShaw(\"abbbbcabca\") is " + isShaw("abbbbcabca")); System.out.println("isShaw(\"abbbbcaaabbaabb\") is " + isShaw("abbbbcaaabbaabb")); System.out.println("isShaw(\"abbbbcaabca\") is " + isShaw("abbbbcaabca")); // check getlargest System.out.println("\nWe test getLargest"); System.out.println("The array is arr = { 6.9, -10.3, 6.7, 2.5, 16.4, -3.1}."); double[] arr = { 6.9, -10.3, 6.7, 2.5, 16.4, -3.1}; try { System.out.println("The largest of arr[0:6] is "); System.out.println(getLargest(arr, 0, 6)); } catch(IllegalArgumentException e) { System.out.println("We got an illegal argument exception."); } try { System.out.println("The largest of arr[2:1] is "); System.out.println(getLargest(arr, 2, 1)); } catch(IllegalArgumentException e) { System.out.println("We got an illegal argument exception."); } System.out.println("The largest of arr[2:2] is " + getLargest(arr, 2, 2)); System.out.println("The largest of arr[0:4] is " + getLargest(arr, 0, 4)); // test Raju System.out.println("\nWe test the Raju numbers."); System.out.println("\nWe test the Raju numbers."); try { System.out.println("Raju(-1) is "); System.out.println(Raju(-1)); } catch(IllegalArgumentException e) { System.out.println("We got an illegal argument exception."); } System.out.println("Raju(2) is " + Raju(2)); System.out.println("Raju(4) is " + Raju(4)); System.out.println("Raju(10) is " + Raju(10)); // test binary search System.out.println("\nWe test binary search."); System.out.println("The input array is table = { 2, 4, 6, 8, " + "10, 12, 14 }. "); double[] table = { 2, 4, 6, 8, 10, 12, 14}; System.out.println("2 was found in table[0:6] at index " + binarySearch(table, 0, 6, 2)); System.out.println("3 was found in table[0:6] at index " + binarySearch(table, 0, 6, 3)); System.out.println("4 was found in table[2:6] at index " + binarySearch(table, 2, 6, 4)); System.out.println("12 was found in table[2:5] at index " + binarySearch(table, 2, 5, 12)); System.out.println("\nThis is all folks. I hope that your program worked."); System.exit(0); }