public class StrictPalindrome
extends java.lang.Object
The provided code is incomplete. Modify it so that it works properly and passes the unit tests in
PalindromeTest.java
.
Constructor and Description |
---|
StrictPalindrome() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isStrictPalindrome(java.lang.String word)
Determine if a word is a palindrome.
|
static void |
main(java.lang.String[] unused)
Solicits a single word from the user at the command line and return whether it is a strict
palindrome.
|
public static boolean isStrictPalindrome(java.lang.String word)
Your function should use strict matching of characters, case, and whitspace. So, for example, you should consider "A man, a plan, a cam, a yak, a yam, a canal – Panama!" to _not_ be a palindrome, "ABba" to not be a palindrome, while "A-B-B-A" is a palindrome.
Add the function declaration below and write this function. Call it isStrictPalindrome. It should take a single String argument and return a boolean.
word
- the word to search forpublic static void main(java.lang.String[] unused)
You are free to review this function, but should not modify it. Note that this function is not tested by the test suite, as it is purely to aid your own interactive testing. Note that this function will not accept inputs that contain spaces, but your palindrome function should handle them properly. If you consider this a limitation, feel free to modify the code below so that it accepts multi-word inputs.
unused
- unused input arguments