Difference between revisions of "Week 5"
From CompSciWiki
Line 3: | Line 3: | ||
|ProblemName=Palindromes | |ProblemName=Palindromes | ||
− | |Problem= | + | |Problem= |
− | Complete the program Palindrom below that checks if a word is palindrome. | + | Complete the program Palindrom below that checks if a word is palindrome.<br/> |
− | If the word is palindrome, print out "It's a palindrome." using System.out.println(). | + | If the word is palindrome, print out "It's a palindrome." using System.out.println().<br/> |
− | Otherwise, print out reversed order of the word. | + | Otherwise, print out reversed order of the word.<br/> |
− | You will need to IGNORE the blanks in the string. | + | You will need to IGNORE the blanks in the string.<br/> |
− | Two strings are provided and find out whether they are palindromes or not. | + | Two strings are provided and find out whether they are palindromes or not.<br/> |
− | + | <br/> | |
− | For example, "deed" and "civic" are palindromes. | + | For example, "deed" and "civic" are palindromes.<br/> |
− | "tomato" and "mama" are not palindromes. | + | "tomato" and "mama" are not palindromes.<br/> |
− | + | <pre> | |
public class asd | public class asd | ||
{ | { |
Revision as of 00:13, 2 April 2010
Back to the Program-A-Day homepage
ProblemComplete the program Palindrom below that checks if a word is palindrome. public class asd { public static void main(String[] args) { String testWord1 = "Are we not drawn onward, we few, drawn onward to new era" String testWord2 = "Murder for a jar of red rum" // Your code goes here } } |
...by students
An image or By Students section | |
---|---|---|
SolutionThe solution... | ||
Code |