Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PROGRAMMING Write a class to make crossword puzzles. I basically want 4 methods in the class Crossword.One to import the list of words file

JAVA PROGRAMMING

Write a class to make crossword puzzles.

I basically want 4 methods in the class Crossword.One to import the list of words file into the class. Second toactually build the crossword. Third to display the puzzle with theformat below or something that's neat ideally. Fourth for thedriver method that basically makes it easier for the user tointeract. This doesn't have to exactly follow the parameters belowand something close to a actual crossword puzzle thats userinteractive would be good too. Would love any help onthis.

  • importWords: a method to read a dictionaryfile either from local storage or from a website

  • You can use a text file with random English words, so that thewords can be selected at random to generate the crosswordpuzzle.

  • buildCrossword: a method to build apuzzle, by selecting an imported word at random and placing it inthe middle row of the puzzle, so that its middle letter is at thecenter column of the puzzle. The most critical requirements hereare:

    • The number of blocked cells in the puzzle cannot exceed 25% or50% of its total cells. Whichever is easier.
    • Words cannot be repeated in a puzzle.
    • Every word in the puzzle must bea legal word, i.e., a word imported from thetext file with words
    • No word with less than 2 letters are allowed.
  • showCrossword: a method to display thepuzzle, followed by its clues: firstthe across clues and thenthe down clues. The method should also provide asummary for the puzzle: its size (e.g., 10 lines by 15 columns),the number of words it contains, and the percentage of squares thatare blocked. You can use the word itself as its clue, as shownbelow. Notice that the letters in the puzzle grid are shown asupper case only, while in the cues they appear in mixed case. Alsonotice that blocked cells are marked with #'s

+------+------+------+| 1    | 2    |      ||   K  |   I  |   D  |+------+------+------+| #### |      | #### || #### |   S  | #### |+------+------+------+|  ... |  ### | ...  |          ###Across: 1. Kid ...Down: 2. Is

A driver method

In addition to the methods importWords, buildCrossword, andshowCrossword, write a driver method to demonstrate your system.The driver method should be named driver, bevoid, and return no values. It should provide interactivity withthe user, as follows:

public void driver() {    boolean keepRunning = true;    while (keepRunning) {        /*         Show user a menu of options, e.g., enter two numbers greater than zero        to create a puzzle with as many rows and columns, or enter zero to exit        the program.                If N==0 and M==0:          keepRunning <-- false        else:          If user enters N>0 and M>0, build a NxM puzzle as specified in the project.                  Show the puzzle.                           }}

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

Entrepreneurship

Authors: Andrew Zacharakis, William D Bygrave

5th Edition

1119563097, 9781119563099

More Books

Students also viewed these Programming questions

Question

24. What effect does a lean production environment have on MRP?

Answered: 1 week ago