Get Academic Help Instantly!

https://bestqualitywriters.com/programming-homework-help-449/

Java 2 Programming and Auto Complete Task

 

I’m working on a java question and need guidance to help me understand better.

Is about autocomplete, 3 small classes need to be done 

Class 1

public class Term implements Comparable<Term> { /**
    * Initialize a term with the given query and weight.
    * This method throws a NullPointerException if query is null,
    * and an IllegalArgumentException if weight is negative.
    */
public Term(String query, long weight) { } /**
    * Compares the two terms in descending order of weight.
    */
public static Comparator<Term> byDescendingWeightOrder() { } /**
    * Compares the two terms in ascending lexicographic order of query,
    * but using only the first length characters of query. This method
    * throws an IllegalArgumentException if length is less than or equal
    * to zero.
    */
public static Comparator<Term> byPrefixOrder(int length) { } /**
    * Compares this term with the other term in ascending lexicographic order
    * of query.
    */
@Override public int compareTo(Term other) { } /**
    * Returns a string representation of this term in the following format:
    * query followed by a tab followed by weight
    */
@Override public String toString(){ } } 

Class 2

public class BinarySearch { /**
    * Returns the index of the first key in a[] that equals the search key,
    * or -1 if no such key exists. This method throws a NullPointerException
    * if any parameter is null.
    */
public static <Key> int firstIndexOf(Key[] a, Key key, Comparator<Key> comparator) { } /**
    * Returns the index of the last key in a[] that equals the search key,
    * or -1 if no such key exists. This method throws a NullPointerException
    * if any parameter is null.
    */
public static <Key> int lastIndexOf(Key[] a, Key key, Comparator<Key> comparator) { } 

Class 3

public class Autocomplete { /**
* Initializes a data structure from the given array of terms.
* This method throws a NullPointerException if terms is null.
*/
public Autocomplete(Term[] terms) { } /**
* Returns all terms that start with the given prefix, in descending order of weight.
* This method throws a NullPointerException if prefix is null.
*/
public Term[] allMatches(String prefix) { } } 

Solved!:

10% off for this assignment.

Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET10 to claim 10% Discount This Month!!

Why US?

100% Confidentiality
100% Timely Delivery
100% Original Writing

100% Money Back

Cheap Essay Writing

Do my Assignment

Order custom essay

Sample Essays

Custom term paper

Write My Research Paper

Affiliate program

Custom essay

Research paper

Write my essay

Write my paper

Essay writers

Become a Freelance Writer

Contact us

Glossary

Sitemap

Terms and conditions

Privacy policy

Proficient Concepts  is a professional writing service that provides original papers. Our products include academic papers of varying complexity and other personalized services, along with research materials for assistance purposes only. All the materials from our website should be used with proper references.