Assignment 6 – Collections Due Date: 9 Apr 2015, This Assignment is worth 6% of your final grade. The maximal number of marks is 20. NO LATE SUBMISSIONS ACCEPTED. Purpose: The purpose of this Assignment is to: Practice Collections. Be sure to read the following general instructions carefully: Your Java Eclipse project name must be A6Student where Student is your full name.. For example if your full name is John Smith, your Java Eclipse project name must be A6JohnSmith. Please note if your project name does not follow this convention, your lose 25% of your marks (5 marks).. Your package name must be pnnnnnn where nnnnnn is your student ID. If your package name does not follow this convention, you lose 25% of your marks (5 marks). Once your work is completed, zip your Eclipse project folder using same convention as your Project. If your submission name does not follow this convention, you lose 25% of your marks (5 marks). Post your work in the appropriate dropbox on e-centennial. No submission in other formats will be accepted for grading. Problem 1. A palindrome is a string that reads the same forward as well as backward.
For example, “Taco cat” and “don’t nod” are palindromes. When determining if a string is a palindrome, we ignore characters that are not letters and also we ignore the case (that is, lower case "a" is considered the same as upper case "A"). Write the code for a class named Palindromexxx where xxx are three last digits of your student ID. (Note: if you fail to name your class as required, you lose 5 marks). The class Palindromexxx must have a static method called isPalindrome which takes a String as a formal parameter and returns a boolean value: public static boolean isPalindromexxx(String sentence) The method isPalindrome must use a Stack and a Queue from Java collections to process the string sentence and return true if the value stored in sentence is a palindrome and false otherwise. The method must be iterative (that is, this method must use a loop and must NOT use recursion in any way). 2) Write a console application that prompts the user for a string and invokes isPalindrome method (statically!) and displays the messages "The given string is palindrome" or "The given string is not a palindrome" depending on the result of the isPalindrome. A sample user interaction session is shown below: Please enter a string (hit Enter to exit the program): don't nod This string is a palindrome. Please enter a string (hit Enter to exit the program): test This string is not a palindrome. Please enter a string (hit Enter to exit the program):
Get Free Quote!
278 Experts Online