Question: Write Java code for methods public Dictionary( File f ) throws IllegalArgumentException A one parameter constructor that takes a File object as a parameter. The
Write Java code for methods
public Dictionary( File f ) throws IllegalArgumentException
A one parameter constructor that takes a File object as a parameter. The dictionary should be populated with the words stored in the file. If anything goes wrong (the file does not exist, it is not readable) the constructor should throw an instance of IllegalArgumentException with an appropriate message. (File is in txt.)
Other methods in this class:
public boolean isWord( String str ) A method that determines if the argument string str is one of the words stored in this dictionary. This method should use binary search.
public boolean isPrefix( String str ) A method that determines if the argument string str is a prefix for at least one of the words stored in this dictionary. This method should use binary search like approach. You may need additional private methods that provide the actual recursive implementation of algorithms that search for words and prefixes.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
