PALINDROMES!!!
A palindrome is a sequence of text that reads the same backwards and forwards. The word cat reversed is tac, so cat is not a palindrome. The word toot reversed is toot, so toot is a palindrome. The word racecars reversed is sracecar. So it is not a palindrome. However, racecar reversed is again racecar, so racecar is a palindrome. Ignoring punctuation and capitalizing, reversing the letters of Able was I ere I saw Elba., you get able was I ere I saw Elba This sentence is a palindrome. Ignoring punctuation and spacing, the sentence, Madam I'm Adam is also a palindrome. For your next program, the user is to enter a string of text and you are to determine if the sequence entered is a Palindrome. You must figure out how to correctly reverse the letters of a string and then compare the two string values. Remember, to compare the text of two strings you must use the .equals( ) method. You can not use = = to compare string objects. To get credit for this program, YOU MAY NOT USE the reverse( ) method in the StringBuilder class. You will have to do it by actually reversing the letters in the text to create a second string to compare to the first. For this first version, do not enter punctuation, and you do not have to consider spacing or capitalization. This program will be due on Friday, 4/16/20. Comments are closed.
|
Archives
May 2020
Categories |