ITI 1121 Final: ITI 1121 University of Ottawa 2006 Final Exam-en

91 views18 pages

Document Summary

Complete the implementation of the static method boolean ispalindrome( charreader r ). Let"s de ne a palindrome as a word or a phrase that reads the same forward and backward if the punctuation symbols and spaces are ignored. Examples of palindromes include: i prefer pi, never odd or even, was it a cat i saw. Boolean hasmorechars(); returns true if the reader has more characters to return, that is if a call to char nextchar() would succeed, and false otherwise; For this question, a stack stores characters. public interface stack { public abstract boolean isempty(); public abstract char peek(); public abstract char pop(); public abstract void push( char element ): the class queueimpl implements the interface queue. Page 3 of 18 public static boolean ispalindrome( charreader reader ) { boolean answer = true; while ( reader. hasmorechars() ) { char c = reader. nextchar(); return answer;

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents