Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions