A palindrome is a string that reads the same forward and backward, i.e., the letters are the same whether you read them from right to left or from left to right.

Examples:

a) radar -> is a palindrome
b)Able was I ere I saw Elba -> is a palindrome
c)good -> not a palindrome

Write a java program to read a line of text and tell if the line is a palindrome. Use a stack to read each non-blank character on a stack. Treat both upper-case and lower-case version of the letter as being the same character.

- Provide these 5 sample outputs and tell if each is a palindrome or not.

Too bad--I hid a boot

Some men interpret eight memos

"Go Hang a Salami! I'm a Lasagna Hog"
(title of a book on palindromes by Jon Agee, 1991)

A man, a plan, a canalPanama

Gateman sees my name, garageman sees name tag

1. Show the LinkedtStackADT< T > interface

2. Create a LinkedStackDS< T > with the following methods: default constructor, overloaded constructor, copy constructor, isEmptyStack, push, peek, pop

3. Create a private inner StackNode class with the following methods: default constructor, overloaded constructor, toString

4. Exception classes: StackException, StackUnderflowException, StackOverflowException

5. Create a PalindromeDemo class that instantiates a LinkedStackDS object. Execute a do-while loop that asks the user using dialog boxes to "Input a String for Palindrome Test:" Use the replaceAll method to remove all blanks and special characters from testStr. Output whether or not it is a palindrome in a dialog box. [Use the 5 inputs given on the other handout sheet for testing.]

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.