Write a program that allows the user to enter in a String, then outputs an accurate statement about whether it is a palindrome or not.
This method will take a string text as an argument and return true if text is a palindrome (the same when read forward or backwards, as in “Madam, I’m Adam”). In testing for a palindrome, ignore all spaces, punctuation marks, apostrophes, and other non-alphanumeric characters, and consider upper- and lowercase letters the same. Don’t let your method change the original string
my code that has compile times errors on the method :
[code]
import java.util.Scanner;
public class palindromette{
public static void main (String[] args) {
String user_input;
Scanner scan = new Scanner(System.in);
System.out.println ("Welcome to the Palindrome Application!");
System.out.println ("This application will determine whether or not your input is a palindrome.");
System.out.print ("Please enter a string:");
user_input = scan.next();
palindrome
boolean palindromeTest (String input) {
int left_side = 0;
int right_side = input.length() - 1;
while ((input.charAt(right_side) == input.charAt(left_side)) && (right_side > left_side)) {
right_side--;
left_side++;
}
if (right_side > left_side)
return false;
else
return true;
}
if (palindromeTest == true)
System.out.print ("palindrome.");
else
System.out.print ("not palindrome");
}
}
