Answer to Question #45224 in Java | JSP | JSF for Young

Question #45224
Palindromes

A word is said to be a palindrome if it is spelt the same forwards as backwards. For example, 'eye' and 'racecar' are palindromes, but 'hello' and 'book' are not.

Write a class Palindromes that uses a stack and/or queue to check whether a given word is a palindrome (case-sensitive). Use the structure shown below:

public class Palindromes {
/**
* Returns true if word is a palindrome, false if not
*/
public static boolean isPalindrome(String word) throws EmptyStackException, EmptyQueueException;
}

To test your code, Add a JUnit test class PalindromesTest, and include at least the following test cases:

testEmptyString(), which checks that the empty string is a palindrome
testBasicPalindromes(), which ensures that 'eye' and 'racecar' are palindromes
testBasicNonPalindromes(), which ensures that 'hello' and 'book' are not palindromes
testCase(), which checks that 'EyE' is a palindrome but 'Eye' is not
0
Expert's answer

Answer in progress...

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS