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
Concept explainers
Question
A palindrome is a word or a phrase that is the same when read both forward and backward. Examples are: "bob," "sees," or "never odd or even" (ignoring spaces). Write a program whose input is a word or phrase, and that outputs whether the input is a palindrome.
Ex: If the input is:
bob
the output is:
bob is a palindrome
Ex: If the input is:
bobby
the output is:
bobby is not a palindrome
import java.util.Scanner;
public class LabProgram {
public static void main(String[] args) {
/* Type your code here. */
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
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
- stop = result = 0 for a in range (2): int (input ( ) ) Type the program's output print (a, end=': ') for b in range (3): result += a + b if result > stop: print () print('-', end=' ') continue print (result, end=' ') Input 4 Outputarrow_forward1. Write a Python program to print the following string in a specific format (see the output). Sample String : "Twinkle, twinkle, little star, How I wonder what you are! Up above the world so high, Like a diamond in the sky. Twinkle, twinkle, little star, How I wonder what you are" Output : Twinkle, twinkle, little star, How I wonder what you are! Up above the world so high, Like a diamond in the sky. Twinkle, twinkle, little star, How I wonder what you arearrow_forwardSuppose your instructor gives three exams during the semester and you want to write a program that calculates your average exam score. Answer the following: a. What items of input must the user enter? b. Once the input has been entered, how will the program determine the average? c. What output will the program display?arrow_forward
- Design a program that takes a string as input from the user and prints its length.7. Create a script that takes a string as input from the user and prints it reversed.8. Create a Python script that asks the user to enter two strings and then prints their concatenation.9. Create a Python program that asks the user for their age and prints out a message saying whether theyare a teenager (between 13 and 19 years old) or not.10. Design a program that prompts the user to enter a positive integer and then prints whether it is a primenumber or not.11. Design a program that calculates the factorial of a given number using a loop. Ensure the input numberis a positive integer.12. Develop a program that prompts the user for the lengths of three sides of a triangle and prints whetherthe triangle is equilateral, isosceles, or scalene.arrow_forwardWrite and implement an algorithm that gets the amount of electricity used in kilowatt-hours and the cost of electricity per kilowatt-hour. Its output is the total amount of the electric bill, including an 8% sales tax. Write your answer to the following as multiple line comments at the beginning of your program.1. What are the data requirements of your program?2. Outline your algorithm using a pseudocode.arrow_forwardWrite Boolean expressions in Python for these values: 1. x is a factor of y (that is, x divides evenly into y) 2. age is at least 18 and state equals “Iowa” 3. The string name contains a “z”arrow_forward
- Write a program whose inputs are three integers, and whose output is the smallest of the three values. Ex: If the input is: 7 15 3 the output is: 3arrow_forwardQuestion: A palindrome is a word or a phrase that is the same when read both forward and backward. Examples are: "bob," "sees," or "never odd or even" (ignoring spaces). Write a program whose input is a word or phrase, and that outputs whether the input is a palindrome. Ex: If the input is: bob the output is: palindrome: bob Ex: If the input is: bobby the output is: not a palindrome: bobby Hint: Start by just handling single-word input, and submit for grading. Once passing single-word test cases, extend the program to handle phrases. If the input is a phrase, remove or ignore spaces. My Issue: I'm unable to use replaceAll(" ", "") as the java program wouldn't allow me as we're working on loops this week and haven't touch upon it. I've attached a screenshot where replaceAll method resulted in no output with the error displayed "Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 16". Regardless,I don't know how to include the space in the…arrow_forwardFor the pseudo-code program below and its auxiliary function: X= 3 y 100 + sqr(x)) = print y define sqr(x) a=x*x return a The output of the print statement will be: O 100 03 O 103 109 09arrow_forward
- Don't use ai to answer Solve itarrow_forwardHelp with my homework. Thank you so much.arrow_forwardMust show it in Python: Please show step by step with comments. Please show it in simplest form. Input and Output must match with the Question Please go through the Question very carefully.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