JAVA Program For this program you should not use a while loop. Instead try to write a recursive method that doesn't copy the string over and over again. You still have time to change it. Chapter 16. PC #5. Palindrome Detector (page 1073) A palindrome is any word, phrase, or sentence that reads the same forward and backward. Here are some well-known palindromes: Able was I, ere I saw Elba A man, a plan, a canal, Panama Desserts, I stressed Kayak Write a boolean method that uses recursion to determine whether a String argument is a palindrome. The method should return true if the argument reads the same forward and backward. Demonstrate the method in a program. The program should ask the user to enter a string, which is checked for palindrome property. The program displays whether the given input is a palindrome or not, then prompts the user to enter another string. If the user enters QUIT (case insensitive, then exit the program). Test Case 1 Please enter a string to test for palindrome or type QUIT to exit:\n Desserts, I stressedENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n KayakENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n quitENTER Test Case 2 Please enter a string to test for palindrome or type QUIT to exit:\n dadENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n quitENTER Test Case 3 Please enter a string to test for palindrome or type QUIT to exit:\n momENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n QuitENTER Test Case 4 Please enter a string to test for palindrome or type QUIT to exit:\n helloENTER The input is not a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n quiTENTER Please enter a string to test for palindrome or type QUIT to exit:\n b,a,dENTER The input is not a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n quitENTER Test Case 6 Please enter a string to test for palindrome or type QUIT to exit:\n Able was I, ere I saw ElbaENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n quitENTER Test Case 7 Passed! Please enter a string to test for palindrome or type QUIT to exit:\n A man, a plan, a canal, PanamaENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n quitENTER Test Case 8 Please enter a string to test for palindrome or type QUIT to exit:\n @abENTER The input is not a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n ab@ENTER The input is not a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n @aaENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n aa@ENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n quitENTER Test Case 9 Please enter a string to test for palindrome or type QUIT to exit:\n abbaENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n abcaENTER The input is not a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n aabcaaENTER The input is not a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n abaceedabaENTER The input is not a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n quitENTER
JAVA Program For this program you should not use a while loop. Instead try to write a recursive method that doesn't copy the string over and over again. You still have time to change it. Chapter 16. PC #5. Palindrome Detector (page 1073) A palindrome is any word, phrase, or sentence that reads the same forward and backward. Here are some well-known palindromes: Able was I, ere I saw Elba A man, a plan, a canal, Panama Desserts, I stressed Kayak Write a boolean method that uses recursion to determine whether a String argument is a palindrome. The method should return true if the argument reads the same forward and backward. Demonstrate the method in a program. The program should ask the user to enter a string, which is checked for palindrome property. The program displays whether the given input is a palindrome or not, then prompts the user to enter another string. If the user enters QUIT (case insensitive, then exit the program). Test Case 1 Please enter a string to test for palindrome or type QUIT to exit:\n Desserts, I stressedENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n KayakENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n quitENTER Test Case 2 Please enter a string to test for palindrome or type QUIT to exit:\n dadENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n quitENTER Test Case 3 Please enter a string to test for palindrome or type QUIT to exit:\n momENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n QuitENTER Test Case 4 Please enter a string to test for palindrome or type QUIT to exit:\n helloENTER The input is not a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n quiTENTER Please enter a string to test for palindrome or type QUIT to exit:\n b,a,dENTER The input is not a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n quitENTER Test Case 6 Please enter a string to test for palindrome or type QUIT to exit:\n Able was I, ere I saw ElbaENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n quitENTER Test Case 7 Passed! Please enter a string to test for palindrome or type QUIT to exit:\n A man, a plan, a canal, PanamaENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n quitENTER Test Case 8 Please enter a string to test for palindrome or type QUIT to exit:\n @abENTER The input is not a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n ab@ENTER The input is not a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n @aaENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n aa@ENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n quitENTER Test Case 9 Please enter a string to test for palindrome or type QUIT to exit:\n abbaENTER The input is a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n abcaENTER The input is not a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n aabcaaENTER The input is not a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n abaceedabaENTER The input is not a palindrome.\n Please enter a string to test for palindrome or type QUIT to exit:\n quitENTER
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
JAVA Program
For this program you should not use a while loop. Instead try to write a recursive method that doesn't copy the string over and over again. You still have time to change it.
Chapter 16. PC #5. Palindrome Detector (page 1073)
A palindrome is any word, phrase, or sentence that reads the same forward and backward. Here are some well-known palindromes:
Able was I, ere I saw Elba
A man, a plan, a canal, Panama
Desserts, I stressed
Kayak
Write a boolean method that uses recursion to determine whether a String argument is a palindrome. The method should return true if the argument reads the same forward and backward. Demonstrate the method in a program.
The program should ask the user to enter a string, which is checked for palindrome property. The program displays whether the given input is a palindrome or not, then prompts the user to enter another string. If the user enters QUIT (case insensitive, then exit the program).
Test Case 1
Please enter a string to test for palindrome or type QUIT to exit:\n
Desserts, I stressedENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
KayakENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
quitENTER
Desserts, I stressedENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
KayakENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
quitENTER
Test Case 2
Please enter a string to test for palindrome or type QUIT to exit:\n
dadENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
quitENTER
dadENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
quitENTER
Test Case 3
Please enter a string to test for palindrome or type QUIT to exit:\n
momENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
QuitENTER
momENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
QuitENTER
Test Case 4
Please enter a string to test for palindrome or type QUIT to exit:\n
helloENTER
The input is not a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
quiTENTER
helloENTER
The input is not a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
quiTENTER
Please enter a string to test for palindrome or type QUIT to exit:\n
b,a,dENTER
The input is not a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
quitENTER
b,a,dENTER
The input is not a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
quitENTER
Test Case 6
Please enter a string to test for palindrome or type QUIT to exit:\n
Able was I, ere I saw ElbaENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
quitENTER
Able was I, ere I saw ElbaENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
quitENTER
Test Case 7
Passed!
Please enter a string to test for palindrome or type QUIT to exit:\n
A man, a plan, a canal, PanamaENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
quitENTER
A man, a plan, a canal, PanamaENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
quitENTER
Test Case 8
Please enter a string to test for palindrome or type QUIT to exit:\n
@abENTER
The input is not a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
ab@ENTER
The input is not a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
@aaENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
aa@ENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
quitENTER
@abENTER
The input is not a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
ab@ENTER
The input is not a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
@aaENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
aa@ENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
quitENTER
Test Case 9
Please enter a string to test for palindrome or type QUIT to exit:\n
abbaENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
abcaENTER
The input is not a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
aabcaaENTER
The input is not a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
abaceedabaENTER
The input is not a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
quitENTER
abbaENTER
The input is a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
abcaENTER
The input is not a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
aabcaaENTER
The input is not a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
abaceedabaENTER
The input is not a palindrome.\n
Please enter a string to test for palindrome or type QUIT to exit:\n
quitENTER
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 3 images
Knowledge Booster
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.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education