[Solved] CS212 Lab 23-Recursive Programming

$25

File Name: CS212_Lab_23_Recursive_Programming.zip
File Size: 320.28 KB

SKU: [Solved] CS212 Lab 23-Recursive Programming Category: Tag:
5/5 - (1 vote)

Rate this product

Recursive Programming.

Create a new Eclipse project for Lab23.

Write a recursive method that will determine if a given String is a palindrome (a string that reads the same forwards and backwards (except for spaces, etc.).

For example,

        isPalindrome("noon");

would return true.Remember, you need a base case (the empty String is a palindrome, the null String is

not.)Recursive case: A String is a palindrome if the first and last letters are the same, and the

String that remains after removing the first and last letters is a palindrome. For example, noon -> noon -> oo -> Hint: To break up the String, substring(noon,1,4) is oo.What about the spaces? Ignore them by proceeding to the next recursive call.

                              "Madam, I'm Adam"                               "adam, I'm Ada"                                "dam, I'm Ad"                                 "am, I'm A"                                  "m, I'm "                                  "m, I'm"                                    ", I"                                    " I"                                     "I"                                     ""

You may also find these methods from the wrapper class Character helpful:

Character.isLetter(char ch) Character.toUpperCase(Char ch)

Character.toUpperCase(M) is equal to Character.toUpperCase(m)

Try your program on strings that are not palindromes, as well as the following: noon,Madam Im Adam, A man, a plan, a canal, Panama, A Toyota

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CS212 Lab 23-Recursive Programming[Solved] CS212 Lab 23-Recursive Programming
$25