Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java programming In this week's lab, you write methods to operate on a list of words and practice using the ArrayList class in the Java

image text in transcribedjava programming

In this week's lab, you write methods to operate on a list of words and practice using the ArrayList class in the Java Collection Framework. The JUnit test class needs the data file words.txt that contains about 235,000 words of English sorted in ascending dictionary order, so download this file (DropBox link) and copy it into your Lab 9 project folder. Write the following methods in the class WordProblems From this wordlist file, the JUnit test class will use only the proper words made of only the lowercase characters a to z The JUnit test class will output a message "Read 210687 words from words.txt." at initialization so that you know that the wordlist has been successfully read in. Your methods should not modify their parameter arraylist words in any way. Also, the JUnit tester requires that every method must return the words that it finds in the same alphabetical order that they occur in the parameter list words 1. Write the method ArrayList that contains all words in words that match the given pattern so that the found word and the pattern are the same length and contain the same characters in the same positions. The pattern can also contain question mark characters as wildcard characters that match any letter that does not occur anywhere in the pattern, in spirit of the game of Hangman. For example, the words "bridge" and "drudge" would match the pattern "?r??ge", but the words "dredge" and "grunge" would not. 2. Write the method ArrayList findSemordnilaps (ArrayList words) that creates and returns a new ArrayList that contains all semordnilaps in words. A word is (slightly humorously) called a "semordnilap" (the word "palindromes" read backwards) if reading that word backwards gives you another word that is different from the original word. For example, the word "tuba" is a semordnilap, since reading it backwards gives you a new word "abut". However, the word "bob" is not a semordnilap, since it is an ordinary palindrome and reading it backwards produces the same word

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

Recommended Textbook for

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

Students also viewed these Databases questions

Question

=+1. How can the process of movie utilization be described?

Answered: 1 week ago