Question: Create a new class named Palindrome Write a recursive method that takes a String and returns a boolean value indicating whether or not the String

  1. Create a new class named Palindrome
  2. Write a recursive method that takes a String and returns a boolean value indicating whether or not the String is a palindrome. Your program should ignore differences in capitalization, meaning "Racecar" should also be a palindrome. Define your method with the following header:
  3.  public static boolean isPalindrome(String str)
  4. Create a new class named PalindromeTest and write test cases that will thoroughly test your method.
  5. Implement the method. Keep in mind that an empty String and a String with one character are also palindromes. Null string is not.
  6. After you have finished writing your method, run your test class and fix any errors that you discover. Here are some palindromes to help you in your testing: racecar, deIfied, Hannah, Civic, spacecaps.
  7. Include these palindromes as test cases in your test class:
    1. Go hang a salami, I'm a lasagna hog.
    2. A Toyota! Race fast, safe car. A Toyota.
    3. "Tie Mandie," I'd name it.
    4. Wonton? Not now.
    5. Your tests will probably now fail. This is because something is still a palindrome if it contains symbols like: .,!?/\| space character, etc.
    6. Remove all such characters before checking to see if the argument is a palindrome. Reference the API for the Character class to find method(s) that may assist you. API links are at the top of this document.
      • Numbers are not considered symbols. If your String is "1.2.1", the periods should be removed, with 121 being a palindrome.
    7. Run your tests again to make sure they pass.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!