An anagram is a rearrangement of the letters of a word or


Problem:

Anagrams: 

An anagram is a rearrangement of the letters of a word or phrase into a new word or phrase. Some of them can be quite amusing or apt. For example:

  • ok state cowboy = wacky toe boots 
  • live orange = regain love 
  • video games = gives a demo 
  • dr dave cline = devil dancer, evil cad nerd 

Instructions: 

1. Write a console application that prints out a list of all the anagrams from a phrase, with one anagram on each line.

2. Two pieces of input are required, (1) the dictionary file, and (2) the word or phrase to be rearranged. Your program needs to be able to use different dictionary files and query phrases based on keyboard input, either as command line arguments or as prompted by the program.

3. Create all of the anagrams from the input phrase, and print them out, one per line. Only generate each anagram once.

4. Generate the anagrams in order in terms of number of words. That is, generate all anagrams with 1 word, then all with 2 words, then all with 3, and so forth.

5. Test out your program on a number of phrases to find some good anagrams.

6. Optional: be able to exclude certain words, or demand that some words be part of the anagram.

Question checklist: 

  • Write a console program to generate anagrams. 
  • Let the user input both the dictionary file name, as well as a phrase. 
  • Generate anagrams in order from smallest to largest number of words. 
  • Come up with some good anagrams and write them down to share with the class. 
  • Make sure the programs compile and run from the command line without modification. 

Summary

This question is from Computer Science and it explains about writing Java program which can develop anagrams by using dictionary file attached.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: An anagram is a rearrangement of the letters of a word or
Reference No:- TGS01109875

Now Priced at $50 (50% Discount)

Recommended (93%)

Rated (4.5/5)