Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will create a main application with static user defined methods that will determine what strings in an array of strings are palindromes. You will

You will create a main application with static user defined methods that will determine what strings in an array of strings are palindromes. You will use string, string tokenizer (to break up the strings), and string buffer (when more efficient than a string) methods whenever possible (and use them as efficiently as possible).

In main, you will have an array of strings initialized to the strings listed below. In a loop, you will first, send each string to a method to remove all the white space and punctuation marks. The return string will go back into the array. In the same loop, you will second, send each string (now without spaces and punctuation marks) to another method to test if it is a palindrome or not. The boolean return will be tested and you will print each string from the array and print whether that string (as a string without any punctuation marks or whitespace) is a palindrome or not.

In the first method, you must use a StringTokenizer to break up the string, a StringBuffer to put the tokens back together, and convert back to a string to return to main to put back in the array.

In the second method, you must make a StringBuffer version of the string, reverse the StringBuffer all at once with a StringBuffer method, and convert it back to a string for a test against the original string to see if it is the same forward and backward. You will return the boolean result back to main.

Use the following data to initialize your array:

mom

Giants are number one

A Santa at NASA.

Java programming;

Did Hannah see bees? Hannah did!

Make sure you follow directions and use commands and concepts from this chapter. Document your program with at least name, exercise number, and at least 4 lines explaining what the program does. You will also add comments to at least 5 individual lines in the program (comment lines not totally obvious to a novice programmer, especially on objects and method calls). Run your program with the data above initialized in your array. Save (or Copy and Paste) the Console running of your program into a plain output .txt text file. Submit your .java source code main program and the output .txt saved.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions