Question: Java, Please. A palindrome is a word or a phrase that is the same when read both forward and backward. Examples are: bob, sees, or
Java, Please.
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.
Here is the beginning of the code:
import java.util.Scanner;
public class LabProgram { public static void main(String[] args) { /* Type your code here. */ } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
