Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java: Create a class called WordList.java that has a private ArrayList attribute that holds Strings. Write a sort() method in this class that sorts the

Java:

Create a class called WordList.java that has a private ArrayList attribute that holds Strings.

Write a sort() method in this class that sorts the ArrayList using an algorithm of your choice.

Write a find( String word ) method that searches the ArrayList using a binary search. This method should return an int for the index of the word in the ArrayList. If the word is not found, the method should return -1.

Write a method: public String get( int position ) that returns the word found at the specified position.

Write a method: public int size() that returns the size of the ArrayList (using the size()method of the ArrayList.

Write a constructor that reads in the accompanying text file into the ArrayList and sorts it.

Write a brief driver class called WordTester.java with a single method (public static void main( String[] args )).

Declare and instantiate the WordList class (the list will be read and sorted in the constructor of the WordList.

Prompt the user for a word to search in the WordList.

Report whether or not the word was or was not found in the WordList.

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

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions

Question

LO13.1 List the characteristics of monopolistic competition.

Answered: 1 week ago