Related questions
Concept explainers
Determine whether a string is a palindrome
A palindrome is a string of characters that reads the same from right to left as it does from left to right, regardless of punctuation and spaces.
The specifications for this assignment are:
•Write and test a non-recursive solution in Java that determines whether a string is a palindrome
•Your program should consist of at least two methods:
(1) the main method
(2) the method which performs the task of determining whether the specified string is a palindrome. You should name this method isPalindrome. You should name the class that contains your "main" method and the isPalindrome method FindPalindrome.
•You must use a Stack and a Queue in your solution:
Write your own Stack and Queue based on the
•All of your belong to a Java package named course.datastructures.pa03.
•Java solution must prompt user for a string, such as:Enter string:
•Solution must prompt user to test another string and act appropriately according to response. If the responds "y", then the user should be prompted to enter a string, else the program should terminate.
•The output from your program should appear similar to the following example:
/***
Enter String: radar
The string "radar" is a palindrome.
Test another string (y or n): y
Enter string: Madam I'm Adam
The string "Madam I'm Adam" is a palindrome
Enter String: Shadow of the Tomb Raider
The String "Shadow of the Tomb Raider" is not a palindrome.
Test another string (y or n): n
... finish
***/
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
- Lab Goal : This lab was designed to teach you more about recursion. Lab Description : Take a string and remove all occurrences of the word chicken and count how many chickens were removed. Keep in mind that removing a chicken might show a previously hidden chicken. You may find substring and indexOf useful. achickchickenen - removing the 1st chicken would leave achicken behindachicken - removing the 2nd chicken would leave a behindSample Data : itatfunitatchickenfunchchickchickenenickenchickchickfunchickenbouncetheballchickenSample Output : 01302arrow_forwardJava String objects are immutable. Select one: O True Falsearrow_forwardGiven a long string use recursion to traverse the string and replace every vowel (A,E,I,O,U) with an @ sign. You cannot change the method header. public String encodeVowels(String s){ // Your code here }arrow_forward
- Please &-. Write a Java program to check if a given string is a palindrome or not. A palindrome is a word, phrase, number, or other sequence of characters that reads the same backward as forward, ignoring spaces, punctuation, and capitalization. For example, "racecar" and "Madam" are palindromes, while "hello" and "Java" are not. Your program should take a string as input and return true if it's a palindrome, and false otherwise. Ik.?arrow_forwardJAVA Language: Transpose Rotate. Question: Modify Transpose.encode() so that it uses a rotation instead of a reversal. That is, a word like "hello" should be encoded as "ohell" with a rotation of one character. (Hint: use a loop to append the letters into a new string) import java.util.*; public class TestTranspose { public static void main(String[] args) { String plain = "this is the secret message"; // Here's the message Transpose transpose = new Transpose(); String secret = transpose.encrypt(plain); System.out.println("\n ********* Transpose Cipher Encryption *********"); System.out.println("PlainText: " + plain); // Display the results System.out.println("Encrypted: " + secret); System.out.println("Decrypted: " + transpose.decrypt(secret));// Decrypt } } abstract class Cipher { public String encrypt(String s) { StringBuffer result = new...arrow_forwardif strings are immutable, like in Java, we can assume that they have a static length True Falsearrow_forward
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education