Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Final Project - The Anagrammers. You have been hired by law enforcement to help thwart a terrorist plot. Law enforcement have identified suspects that communicate

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
Final Project - The Anagrammers. You have been hired by law enforcement to help thwart a terrorist plot. Law enforcement have identified suspects that communicate over the web using mostly anagrams. These suspects have been referred to as the Anagrammers. As defined by Wikipedia, an anagram is a word or name formed by rearranging the letters of another, such as cinema, formed from iceman. Your job is to write a program that can be executed from a command window or terminal which accepts an anagram and prints all possible combinations of words. Hint: the number of possible words derived from an anagram equals the factorial of the number of letters in the anagram. For example, DOG would result in 3 factorial combinations, IE 3 * 2 * 1 =6 possible words. ( DGO, DOG, GDO, GOD, ODG, OGD ) Please place all of your code in the edu.institution.finalproj package within your existing Eclipse project. Command Line Interface (CLI) Anagrammer You are to create a command line interface (CLI) program, called Anagrammer. A CLI will need a public static void main (String args) method, where values will be supplied in the args parameter from the command line. Apache Commons CLI The goal of the Apache Software Foundation (ASF) is to provide open source software for the public use. One of the libraries contained in the ASF is the Apache Commons CLI. The Apache Commons CLI library provides an API for parsing command line options passed to programs. It is also able to print help messages detailing the options available for a command line tool. You are required to use this library to parse the command line arguments. The supporting files download contains the JAR for this library. You will need to add the jar to your classpath to use the classes. The documentation for the Apache Commons CLI can be found at ( https://commons.apache.org/proper/commons-cli/index.html ). Refer to the Usage Scenarios section within the User Guide for code examples. The Apache Commons CLI JAR is already in your project and in your class path. You do not have to download and add this JAR yourself to the project. The valid command line arguments are as follows. Command Line Arguments Option Argument Description-a or --anagram Supplies the anagram to evaluate -nf or --no-filter output all anagram values with no filter -words or --filter-words output only values that are known words -h or --help displays the help for this program Anagram Evaluator Create an interface called, AnagramEvaluator, and define the following method. Returns a list of words derived from the supplied anagram. Oparam anagram the anagram to evaluate. (param option the command line option. Values are "nf" or "words". If null, default to "words". * Breturn the list of words derived from the supplied anagram. List evaluate(String anagram, String option) ; Create an implementation of the AnagramEvaluator interface, called AnagramEvaluatorimpl, which performs the logic of returning all possible words derived from the anagram. The option parameter will contain either "of" or "words". If the "of" option is supplied then all possible words derived from the anagram should be returned. If "words" is supplied then only words that exist in the anagram_data.txt file should be returned. For example, Anagrammer -words -a=DOG would return DOG and GOD, ignoring DGO, GDO, ODG, and OGD.Additional Behavior An anagram could result in multiple words that are equal. For example, MAGMA, would result in the word GAMMA more than once because of the multiple M's and A's. You are to restrict the returned list of words to unique words only. No duplicates. Sort the returned list of words alphabetically. Case doesn't matter (ie. "cat" and "CAT" should be treated as the same word). . Output the number of words at the bottom of the list of words Example Output 1. Anagrammer -h usage: anagrammer Options -a, --anagram supplies the anagram to evaluate -h, --help displays this help textdisplays the help for this program -nf, --no-filter output all anagram values with no filter -words, --filter-words output only values that are known words 2. Anagrammer -nf -a DOG DGO DOG GDO GOD ODG OGD -- 6 value(a) found 3 Anagrammer --no-filter -a DOG DGO DOG GDO GOD ODG OGD -- 6 value (s) foundAnagrammer -nf Missing required option: -a Anagrammer -words -a DOG DOG GOD 2 value (s) found 5 Anagrammer --filter-words -a DOG DOG GOD -- 2 value (a) found AnagramDataReader Create an interface called, AnagramDataReader, and define the following method. Read the anagram_data.txt file, which is available from the supporting files download, and return a Set containing the words. There should be 373, 295 unique words. Returns a Set containing all words read from the anagram data text file. Oreturn the Set or empty Set if no words are found. Set readData () ; Create an implementation of the AnagramDataReader interface, called AnagramDataReaderimpl, which performs the logic described in the interface. Unit Tests By now you should be used to writing unit tests to validate your implementation. Provide enough unit tests to prove that you validated your implementation. "Enough" is subjective to my discretion

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_2

Step: 3

blur-text-image_3

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

Unity From Zero To Proficiency Beginner A Step By Step Guide To Coding Your First Game

Authors: Patrick Felicia

1st Edition

1091872023, 978-1091872028

More Books

Students also viewed these Programming questions

Question

(2) How much recognition do people gain for doing a good job?

Answered: 1 week ago

Question

What do they not do so well?

Answered: 1 week ago