Problem

A palindrome is a string that reads the same forward and backward, such as "radar&#3...

A palindrome is a string that reads the same forward and backward, such as "radar". Write a static recursive method that has one parameter of type String and returns true if the argument is a palindrome and false otherwise. Disregard spaces and punctuation marks in the string, and consider upper- and lowercase versions of the same letter to be equal. For example, the following strings should be considered palindromes by your method:

"Straw? No, too stupid a fad, I put soot on warts." "xyzcZYx?"

Your method need not check that the string is a correct English phrase or word. Embed the method in a program, and test it. For an additional challenge, use your palindrome-checking method with the file of English words described in Programming Based on the log file described in programming project write a program to detect cheating. This could occur if:

• A racer misses a sensor, which is a sign that the racer may have taken a shortcut.

• A race split is suspiciously fast, which is a sign that the racer may have hopped in a vehicle. In this case, a race split faster than 4:30 per mile can be considered suspicious.

The output should be a list of suspected cheaters along with the reason for suspicion.to find the word with the longest palindrome.

Create an application in a JFrame GUI that will draw a fractal curve using line segments. Fractals are recursively defined curves. The curve you will draw is based on a line segment between points p1 and p2:

To draw the curve from p1 to p2, you first split the segment into thirds. Then add two segments and offset the middle segment to form part of a square, as shown in the following picture:

Note that you would not draw the arrowheads, but we use them here to indicate the direction of drawing. If the order of p1 and p2 were reversed, the square would be below the original line segment. This process is recursive and is applied to each of the five new line segments, resulting in the following curve:

The fractal is given by repeating this recursive process an infinite number of times. Of course, we will not want to do that and will stop the process after a certain number of times.

To draw this curve, use a recursive method drawFractal(p1x, p1y, p2x, p2y, k). If k is zero, just draw a line from p1 to p2. Otherwise, split the line segment into five segments, as described previously, and recursively call drawFractal for each of these five segments. Use k− 1 for the last argument in the recursive calls. For convenience, you may assume that the segments are either vertical or horizontal.

The initial call should be drawFractal(50, 800, 779, 800, 5). Set the size of the window to 1000 by 1000.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 11
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT