
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
![Write a program that asks the user to enter a string. Pass the string to a method
called palindrome that checks to see if the string is a palindrome. If the string is a
palindrome the method should return true else it should return false. Print out the
result in the main method.
Expected output:
Enter a String: madam
madam is a palindrome
import java.util.Scanner;
public class Final{
public static void main(String[] args){
Scanner inputData=new Scanner(System.in);](https://content.bartleby.com/qna-images/question/480f989f-2af6-48a5-ab4d-ef9ac310c5f5/72a9b9fb-50cc-4a0d-99f1-f13b8d25271f/f1eg4xg_thumbnail.png)
Transcribed Image Text:Write a program that asks the user to enter a string. Pass the string to a method
called palindrome that checks to see if the string is a palindrome. If the string is a
palindrome the method should return true else it should return false. Print out the
result in the main method.
Expected output:
Enter a String: madam
madam is a palindrome
import java.util.Scanner;
public class Final{
public static void main(String[] args){
Scanner inputData=new Scanner(System.in);
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps with 1 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.Similar questions
- Write a program that reads two phrases on separate lines and outputs one of the four responses: 1) Phrase one is found within phrase two 2) Phrase two is found within phrase one 3) Both phrases match 4) No matches Hint: Use the String method indexOf(). Ex: If the input is: fire firetruck the output is: fire is found within firetruck Ex: If the input is: the green grass grows green grass the output is: green grass is found within the green grass grows Ex: If the input is: pick a card pick a card the output is: Both phrases match Ex: If the input is: apples oranges the output is: No matches(in java please)arrow_forwardWrite a program that asks the user to enter their name and a letter. The program should then use this information to output the string “<your name> guessed the letter <lowercase letter>”, where <your name> is the name entered by the user and <lowercaseletter> is the lowercase form of the letter entered by the user.tip: make use of the method .lower() Example:Enter your name: Jane DoeGuess a letter: AJane Doe guessed the letter aarrow_forwardWrite a program that takes in a string that holds the values "day" or "night" and an integer that holds a person's age, and outputs a movie ticket price. Movie prices are free for everyone under the age of 4. Daytime prices are $8 for everyone age 4 or higher. Nighttime prices are $12 for ages 4 - 16, $15 for ages 17 - 54 and $13 for ages 55 and above. (in java)arrow_forward
- I need help with Java code. I'm not sure how to start...arrow_forwardAssume that a password is valid if and only if it contains at least one letter, at least one digit, and at least five characters in t otal. Write a boolean method named isValidPassword. The method should receive a String and determine whether the String is a valid password. Examples: .isValidPassword ("557s3") should be true • isValidPassword ("55r17s3") should be true isValidPassword ("55753") should be false should be false isValidPassword("eftyh") isValidPassword("5783") should be false Tip: you may want to use the charAt method of the String class and the isDigit and istetter methods of the Character class.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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