3. 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 canal-Panama Gateman sees my name, garageman sees name tag

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question

The first image is the main question and the second image is the directions for the program. The program has to be written in Java and please use the directions given in the second image to write the program.

3. 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 canal-Panama
Gateman sees my name, garageman sees name tag
Transcribed Image Text:3. 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 canal-Panama Gateman sees my name, garageman sees name tag
Program #3
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 <T> class with the following methods: default
constructor, overloaded constructor, toString
3. Exception classes: StackException, StackUnderflowException,
Stack OverflowException
4. Create a Palindrome Demo class that instantiates a LinkedStackDS<Character>
object. Execute a do-while loop that asks the user using dialog boxes to "Input a
String for Palindrome Test:" Use the replace All 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.]
Transcribed Image Text:Program #3 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 <T> class with the following methods: default constructor, overloaded constructor, toString 3. Exception classes: StackException, StackUnderflowException, Stack OverflowException 4. Create a Palindrome Demo class that instantiates a LinkedStackDS<Character> object. Execute a do-while loop that asks the user using dialog boxes to "Input a String for Palindrome Test:" Use the replace All 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.]
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 13 images

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT