PalindromeClient - p package homeWork; /* PalindromeClient...

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

View Full Document Right Arrow Icon
package homeWork; p /* PalindromeClient * Anderson, Franceschi */ * import javax.swing.JOptionPane; import javax.swing.JFrame; import java.awt.Graphics; i public class PalindromeClient extends JFrame { private Palindrome palind; boolean started = false; public PalindromeClient( ) { palind = new Palindrome( ); setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); setSize( 570, 400 ); setVisible( true ); } public Palindrome getPalindrome( ) { return palind; } public void setStarted( boolean b ) { started = b; } public boolean recursivePalindrome( String pal ) { // ***** Student writes the body of this method ***** // Using recursion, determine if a String representing // a word or a sentence is a palindrome // If it is, return true, otherwise return false // We call the method animate inside the body of this method // The call to animate is already coded below animate( pal ); // // Student code starts here // boolean flag; if(pal.length()==1) { flag = false; } if(pal.charAt(0) == pal.charAt(pal.length()-1)) { flag = true;
Background image of page 1

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

View Full DocumentRight Arrow Icon
pal = pal.substring(1, pal.length()-2);
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/10/2009 for the course CS 102 taught by Professor Kanipiakins during the Spring '09 term at University of Maryland Baltimore.

Page1 / 3

PalindromeClient - p package homeWork; /* PalindromeClient...

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

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