Is the second string a substring of the first string (capitalization
is not important)?
Is the first string a palindrome? Is the second string a palindrome?
(A palindrome is spelled the same way backwards as forwards, ignoring case
and spacing.)
Is the second string an anagram of the first string (the same letters
of the first in a different order)?
If your program identifies that the second is a sub-string of the first, it should produce the message stating that. For instance, if the first string is "The woods were dark and foreboding" and the second was "Dark andfor", your program should produce a message that says that the second is a substring of the first. If the second string is not a substring, then produce a message which states that fact. Ignore spacing and capitalization.
Your program should be able to recognize palindromes. For example, "Madam Im Adam" is a palindrome (same backwards as forwards, ignoring spacing and capitalization).
Finally, if your program identifies that the second string is an anagram
of the first string, that message should be displayed. If it is not,
then it will display an appropriate message. For example, it should identify
that "a soft felt cat" is an anagram of "as oft left act", but that "left
act" is not an anagram of "a soft felt cat." Ignore spacing and capitalization.
Please enter string 1: mad ma Please enter string 2: madam Results of tests: madam is not a substring of mad ma mad ma is not a palindrome madam is a palindrome madam is an anagram of mad ma
Your class should have instance variables for the two strings.
You may find it helpful to convert each string to an array of characters for some of the required processing.
Chapter 2's "Java Language Summary" section has information on reading input from the keyboard, including a thoroughly explained example. Pay particular attention to what it suggests regarding exception handling. (We'll be talking in more detail about exception handling later, but the simple solution they suggest is sufficient for now.)
You will probably find the Sun website very helpful for finding useful String methods.