palindromelab

palindromelab - import static java.lang.System.out Write 3...

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

View Full Document Right Arrow Icon
import static java.lang.System.out; // Write 3 methods that each test an input for being a palindrome. // All 3 must be recursive with no loops. // plaindrome2 modifies plaindrome1 to ignore any space characters // in the input string. For example "ab b a" returns false // from palindrome1 but true from palindrome2. // palindrome3 generalizes palindrome2 by using the template // design patter. The client supplies an object used by // palindrome3 to determine which characters to ignore. // You will need to define the interface CharacterFilter and // one class implementing it, SpaceFilter, that causes // palindrome3 to ignore any spaces in the input. // // For String s, s.charAt(int index) returns the single character // at position index. For example, String s = "ab ba" // s.charAt(0) = 'a' s.charAt(1) = 'b' s.charAt(2) = ' ' // Remember that single quotes are used for char literals // and double quotes for strings. // // If you complete palindrome 1-3, write a JUnit test for
Background image of page 1

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

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

{[ snackBarMessage ]}

Page1 / 2

palindromelab - import static java.lang.System.out Write 3...

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