Question: There are code outlines to go with these instructions. How is this coded in Java? Introduction This is intended to reinforce your understanding of working

There are code outlines to go with these instructions. How is this coded in Java?

There are code outlines to go with these instructions. How is thiscoded in Java? Introduction This is intended to reinforce your understanding ofworking with one-dimensional arrays and to encourage you to think algorithmically. Yourtask is to develop an algorithm that solves the problem described using

Introduction This is intended to reinforce your understanding of working with one-dimensional arrays and to encourage you to think algorithmically. Your task is to develop an algorithm that solves the problem described using the provided framework. Countdown "Countdown" is a long running English gameshow where a number of games a featured. In one of the Countdown games, contestants are given a set of nine random letters which the contestants unscramble to find the longest word that they can make using a subset from the randomly chosen letters. For example, given the set of letters "Tonsomali", we can form the following words: "in", "insist", "mission", "mitosis", "omission". Out of these words, the longest word is "omission", 50 "omission" would be the winning word from the set of letters. Note that once a letter is used, it is removed/checked off and cannot be used again unless there are available uncheckedoff copies of that letter. For example, given a different but similar set of letters "ionsmati" where we no longer have a repeat 'o, we can still form the words "in", "insist", "mission", and "mitosis : however, we can no longer form the word "omission" because there are not enough o's in the set of letters. In this case, "mission" would be the winning word. In our game model, we will not bound the maximum number of characters in the set of letters. We will instead pass a string of letters and the string will dictate the maximum length of the available letters to choose from. If two words of the same length can be spelled by the set of words, we will choose the one that comes before the other in the dictionary as the winning word. Instructions This problem is similar to trying to find all anagrams in a dictionary for a given word or determining if a sentence is a pangram; however, it is slightly more challenging because there is no guarantee that it is possible to use all letters provided in the scrambled set of letters. We will use the WordTool class and a dictionary of words to try to find the longest word possible to form from the scramble. I have edited the words file to remove entries from the dictionary that contain special characters like contractions and abbreviations, so you should use the words file provided in the assignment file. A framework for this program has been provided which consists of the files Word Game.java, WordGameUnitTests.java, Countdown java, WordTooljava, and words. Your focus should be on implementing methods in the Word Game class; however, you will find the programs in the Word GameUnitTests and Countdown classes useful, both of which use the WordGame class. For the base implementation, you must implement the WordGame methods: - contains - Search There is an additional method for the challenge. You will receive no credit for the challenge if you have errors in your base implementation, so you should focus first on getting your base implementation fully working, debugged, and documented. For the challenge implementation, you must implement the WordGame method: . collectYou will not alter any of the other code in the framework, you will use the interfaces described later in this document "as is" for the above methods. In the framework, the methods that you will implement are marked with TODO. Read the documentation associated with each method and fulfill the requirements outlined by that method's documentation. search iterates over the a set of words or dictionary and then uses the contains method to determine whether that word can be spelled using a subset of provided letters. The contains method determines if the word is contained in the set of letters. Given the dependence of search on contains, ie. search must use contains and can therefore only work if contains works, you should focus on implementing contains first. The framework provides a set of "Unit Tests" to evaluate your algorithms. The unit tests specifically check the edge cases that you might not consider when developing your methods such as what should happen when a parameter is null. When you run the unit tests, if a test indicates a failure, you should look at the unit test file and see what conditions it checks which should lead you toward a correction in your method implementation. To receive full credit for the base implementation, your program must pass all base unit tests. To receive full credit for the challenge, your program must pass all challenge unit tests. There may be a number of words with the same length that can be formed using the set of letters. We do not necessarily need to know all words that can be formed using the set of letters in the base implentation, so search wil pick the first word in the dictionary that is the longest word. This offers a slight optimization but mostly it ensures that everyone gets the same answer to the first two unit tests. In the challenge, collect will build a new list of all the words that can be spelled with the set of characters. Once you have implemented your WordGame class and validated it with WordGameUnitTests, you can play the game interactively through the Countdown program. The Countdown program allows a user to input a set of letters at the command prompt and then searches the dictionary for the longest candidate word, and it is a basic simulation of the Countdown game. Notes A function clean has been provided that will remove any non-alpha characters from a string, will lowercase the cleaned string, and will return the lowercase, cleaned string. This method will ensure both that only legal letters are evaluated and will eliminate edge cases that we really don't want to deal with when preparing to compare string information. The methods are documented using a style defined by Doxygen. This format allows documentation to be automatically generated from source code. Note how this formal documents what a function does, what each of the inputs represents. and what the return value represents. In the future, your programs must include documentation of functions that you develop yourself, and your function documentation must meet these three criteria. You will not be expected to conform to the Doxygen format, but you will not be discouraged from doing so. Base Requirements The base assignment represents the minimal learning goal. boolean contains String word, String letters) contains determines whether the word specified by the parameter word can be spelled using the characters in the parameter letters. The parameter letters contains the set of letters with which to try to spell the word specified by the parameter word. This method returns true if word can be spelledusing letters; otherwise, the method returns false. There are some edge cases that must be addressed and these edge cases are clearly enumerated by the unit tests. In general, you need to handle what happens if any of the parameters are null. String search(String words, String letters) search searches through the dictionary of words provided by the words parameter and identifies the longest word that can be spelled using the characters provided by the letters parameter. search returns null if any of the parameters are invalid references, returns an empty string if no word is found, or retums the word if a ward is found. Again, there are a number of edge cases that must be addressed and these edge cases are enumerated by the unit tests and accompanying documentation. In addition to handling null parameters, you must also handle what happens when a second word is found that has the same length as an already identified word. Challenge Requirements String[ collect(String words, String letters) collect searches through the dictionary of words provided by the words parameter and identifies all words that can be spelled using the characters provided by the letters parameter. contains returns null if any of the parameters are invalid references, retums an empty amay if no words can be spelled, or the set of all words selected from words that can be spelled using letters. Again, there are a number of edge cases that must be addressed and these edge cases are enumerated by the unit tests and accompanying documentation. You must handle null parameters. You will also need to consider allocations of the array that you are building. FAQ 1. Can I use the AmayList class or any other advanced Java data structure? No. 2. Can I add one or more global variables? Sure, but that would probably be a mistake. You should focus on implementing the methods in WordGame.java, none of which require global variables. 3. Can I change the function retum type? No, the unit tests are designed to evaluate very specific criteria and the functions are specifically designed to plug in to the unit tests. If you change any function signature, i.e. the return type, name, and parameters, you will break the function and your program. Everyone must use the same function interfaces and everyone's code will tested against the same unit tests. 4. Can I change the function parameters? No, see the answer to the above question. 5. Can I add new functions? You mary, but for this particular assignment it is not necessary. Typically, when you define a new function, you must provide unit tests to validate the function and we will be using a rather strict set of unit tests so any custom unit tests you provide will probably be overlooked and not graded.B. Can I change any unit tests? Sort of. You may turn them on and off to help you get started or focus on particular problems; however, your program will have to pass all the unit tests, so don't forged to run the complete battery of tests. You should not permanently change the unit tests as that may mislead you with respect to the tests we will run. 7. Can I add new unit tests? We have tried to be comprehensive in the unit tests provided by testing the important edge cases. You should not need to add unit tests, but you are encouraged to study and understand them as this is a typical validation model and we will regularly use it to evaluate your work in this and future classes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!