starString(int x)method is a recursive method that returns a string with the appropriate number of stars to
starPattern(int x)to be printed. EXAMPLE OUTPUT IF X == 5:
***** **** *** ** *
palindrome(String test)that accepts a string and returns true or false depending on whether it is a palindrome or not. You can use any method of the String class that you think will be useful.
Both of these solutions must be recursive and cannot use loops. Think about what the base cases are and what the recursive case is.
Below is the test code for the TA to verify.
public static void main(String args[]){ R18 rec = new R18(); rec.starPattern(5); System.out.println(); System.out.println ("\'x\' is a palindrome?: " + rec.palindrome("x")); System.out.println("\'car\' is a palindrome?: " + rec.palindrome("car")); System.out.println("\'racecar\' is a palindrome?: " + rec.palindrome("racecar")); System.out.println("\'hannah\' is a palindrome?: " + rec.palindrome("hannah")); System.out.println("\'banana\' is a palindrome?: " + rec.palindrome("banana") + "\n"); }