Page 1 of 1

In the PalindromeQueue class, write Java code for the following question by adding code at the comment labeled ADD YOUR

Posted: Tue Jul 12, 2022 8:16 am
by answerhappygod
In the PalindromeQueue class, write Java code for the followingquestion by adding code at the comment labeled ADD YOUR CODEHERE.
/* Write a Java program thatuses ArrayQueue (array queue fromChapter 3)
* to determine whether an input stringis a palindrome.
* A palindrome is a string of characters(a word, phrase, or
* sentence) that is the same regardlessof whether you read it
* forward or backward.
*
* Here are two sample runs:
* Enter a string: abcdcba
* The input string is a palindrome.
*
* Enter a string: abcdefg
* The input string is not apalindrome.
*/
import java.util.Scanner;
public class PalindromeQueue {
public static voidmain(String[] args) {
System.out.print("Enter a string:");
Scanner input = newScanner(System.in);
String s =input.next(); // input string
String t =""; // reverse string
ArrayQueue queue =new ArrayQueue();
// ADD YOUR CODEHERE
if (s.equals(t))
System.out.println("The input string is a palindrome.");
else
System.out.println("The input string is not apalindrome.");
} // end main
} // end PalindromeQueue