Palindrome - /* / Palindrome.java / / Implementation of a...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // Palindrome.java // // Implementation of a pair of palindrome tests. The first uses // a single Stack to determine if a String is a palindrome when // all characters are considered. The second uses two Stacks to // determine if a String is a palindrome if non-alphanumeric // characters and case are ignored. //******************************************************************** / import java.io.IOException; import java.util.Stack; import java.util.Scanner; i public class Palindrome { p //---------------------------------------------------------------- // Performs two palindrome tests on the given String //---------------------------------------------------------------- public static void testForPalindrome(String str) { boolean isExactPalindrome = true; boolean isPalindrome = true; b // Make a Stack for the "exact" test Stack s1 = new Stack(); S // Push the first half of the string for (int i = 0; i < str.length()/2; i++)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

Palindrome - /* / Palindrome.java / / Implementation of a...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online