Question: //--------------------------------------------------------------------- // Palindrome.java by Dale/Joyce/Weems Chapter 4 // // Provides a method to test whether a string is a palindrome. // Non letters are skipped.

//--------------------------------------------------------------------- // Palindrome.java by Dale/Joyce/Weems Chapter 4 // // Provides a method to test whether a string is a palindrome. // Non letters are skipped. //--------------------------------------------------------------------- package ch04.palindromes;

import ch02.stacks.*; import ch04.queues.*;

public class Palindrome { public static boolean test(String candidate) // Returns true if candidate is a palindrome, false otherwise. { char ch; // current candidate character being processed int length; // length of candidate string char fromStack; // current character popped from stack char fromQueue; // current character dequeued from queue boolean stillPalindrome; // true if string might still be a palindrome

StackInterface stack; // holds non blank string characters QueueInterface queue; // also holds non blank string characters

// initialize variables and structures length = candidate.length(); stack = new ArrayBoundedStack(length); queue = new ArrayBoundedQueue(length);

// obtain and handle characters for (int i = 0; i

 //--------------------------------------------------------------------- // Palindrome.java by Dale/Joyce/Weems Chapter 4 // // Provides a

How would you change the test method of the Palindrome class so that it considers all characters, not just letters? Identify the statements you would change, and how you would change them

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!