Question: Problem 1 (50 pts). Palindrome is a string which reads the same backward or forward. For example, aabbaa and aba are both considered Palindrome while
Problem 1 (50 pts). Palindrome is a string which reads the same backward or forward. For example, aabbaa and aba are both considered Palindrome while ab or aabb are not. Write a Java program to test if a given string is a Palindrome. What to program: The skeleton of the program is given to you in Palindrome.java. Finish the program by yourself. What to submit: Palindrome.java that contains finished program.
import java.lang.*; import java.util.Scanner; public class Palindrome { // You are required to finish this function // Assume input string contains NO blank space or any none-letter character. public static boolean IsPalindrome(String input){ // Check if input is a palindrome, return true if yes, false otherwise. return false; } public static void main(String[] args) { // Test your function here Scanner in = new Scanner(System.in); System.out.println("Let try a string..."); String input = in.next(); if( IsPalindrome(input) ){ System.out.println("It seems " + input + " is a palindrome"); }else{ System.out.println("Nope, " + input + " is not a palindrome"); } } }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
