Please help me implement a Palindrome detector program in Ja
Please help me implement a Palindrome detector program in Java.
The basic algorithm for this program will be:
1.   Remove all punctuation and spaces (work on a copy of the data, maintain the original).
 2.   Change all characters to a single case (either upper or lower).
 3.   Submit each character from the beginning of the string through the end of the string to both a stack and queue. (You have to build these data structures)
 4.   Remove each character from both the stack and queue, comparing the output as they are removed.
 5.   If the end of the stack and queue are reached and there are no mismatches, the string is a valid palindrome.
Legal Input will consist of a user entered sentence. Desired output will be whether or not the input sentence is a palindrome (yes, if it is, no, if it is not). An example of a valid palindrome is: \"A man, a plan, a canal, Panama!\" The letters amanaplanacanalpanama read the same both forward and backwards.
The output should include the original input, the printed output from the stack and queue, and lastly, the palindrome determination (yes or no).
DO NOT USE any built in stack/queue/linked list classes. DO NOT USE any built in methods to adjust, change, or manipulate data (you can use built in compares, and general I/O methods). You must build the classes yourself. Its recommended to use an array for the stack and a linked list for the queue.
Please help me with this code. Remember I can\'t use any of the prebuilt methods in Java. I have to have an options menu to give the user options to enter a new string, delete the current, and then it tells the user if it is a palindrome or not.
Solution
 public class Test {
 public static void main(String[] args) {
 String[] wordPalindromes = {
 \"\", \"a\", \"aa\", \"aba\", \"anna\", \"madam\", \"deified\"
 };
 String[] wordNotPalindromes = {
 \"ab\", \"abc\", \"test\", \"round\"
 };
 String[] phrasePalindromes = {
 \"A car, a man, a maraca.\"
 };
 String[] phraseNotPalindromes = {
 \"Not a palindrome\"
 };
for (int i = 0; i < wordPalindromes.length; i++) {
 assert isTextPalindrome(wordPalindromes[i]);
 assert isPhrasePalindrome(wordPalindromes[i]);
 }
 for (int i = 0; i < wordNotPalindromes.length; i++) {
 assert !isTextPalindrome(wordNotPalindromes[i]);
 assert !isPhrasePalindrome(wordNotPalindromes[i]);
 }
 for (int i = 0; i < phrasePalindromes.length; i++) {
 assert isPhrasePalindrome(phrasePalindromes[i]);
 }
 for (int i = 0; i < phraseNotPalindromes.length; i++) {
 assert !isPhrasePalindrome(phraseNotPalindromes[i]);
 }
 System.out.println(\"Tests passed\");
 }
public static boolean isTextPalindrome(String text) {
 if (text == null) {
 return false;
 }
 int left = 0;
 int right = text.length() - 1;
 while (left < right) {
 if (text.charAt(left++) != text.charAt(right--)) {
 return false;
 }
 }
 return true;
 }
public static boolean isPhrasePalindrome(String text) {
 String chars = text.replaceAll(\"[^a-zA-Z]\", \"\").toLowerCase();
 return isTextPalindrome(chars);
 }
 }


