CyberArmy University | Open Source Institute | CyberArmy Intelligence & Security | CyberArmy Services & Projects

Programming challenge 3 -easy-


[Replies] [Reply] [View by Thread] [Help]
[Back To Programming]

Posted by Delta Cpt dopel On 2008-07-20 23:35:30

Delta CptDelta Cpt
Delta Cpt dopel


Palindrome --
A word, phrase, verse, or sentence that reads the same backward or forward. For example: A man, a plan, a canal, Panama!

Can you see where I am going with this? So this challenge will pick it up a notch to basic text and file processing while demonstrating the first lesson in code reuse.

Requirements:
  • Read in a text file that contains a list of strings.
  • Write a function isPalindrome() that determines if a string is a palindrome. Its input is a single string and ouputs True or False (Boolean). This function MUST use the reverseWord() function written in challenge 2. No reneging for those of you that wrote those l33t command line programs :p
  • Output the strings that qualify as palindromes to a separate results file.
Function prototype: boolean isPalindrome(String)

**
-You may assume that each line of the input file is autonomous and can be treated individually during processing.
-Ignore case and punctuation during comparison, but not for the results.
**

Sample input:
abc
A man, a plan, a canal, Panama!
Dr. Who
ttt
torchwood
0110
racecar
I
20-02-2002
Was it a rat I saw?

Sample output:
A man, a plan, a canal, Panama!
ttt
0110
racecar
I
20-02-2002
Was it a rat I saw?

PS, These challenges will not be in any order of complexity. Some will be easier and some will be harder. All challenges will teach at least one particular skill and many will build on skills previously covered.


Replies:


Guest:
Subject:
Message:
Signature:
Optional Image Link:
http://

CyberArmy::Forum v0.6
Generated In 0.00751 seconds


About Us | Privacy Policy | Mission Statement | Help