PalindromeTester - /* / PalindromeTester.java Author:...

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

View Full Document Right Arrow Icon
//******************************************************************** // PalindromeTester.java Author: Lewis/Loftus // // Solution to Programming Project 11.1 // // Modifies code from Chapter 3 to use recursion to identify a // palindrome //******************************************************************** / import java.util.Scanner; i public class PalindromeTester { private String testString; public PalindromeTester(String test) { testString = convertString(test); } //----------------------------------------------------------------- // Converts a string to correct format; removes all characters // except for number and digits //----------------------------------------------------------------- private String convertString(String str) { StringBuffer convertedString = new StringBuffer(); // convert string to lowercase, remove punctuation and whitespace for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); c = Character.toLowerCase(c); if (Character.isLetterOrDigit(c)) convertedString.append(c);
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.

This note was uploaded on 05/17/2011 for the course COP 3530 taught by Professor Davis during the Spring '08 term at University of Florida.

Page1 / 2

PalindromeTester - /* / PalindromeTester.java Author:...

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