Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In the first program, you are provided a word.txt file. Within the file there are many words listed in it, each word takes one line.

In the first program, you are provided a word.txt file. Within the file there are many words listed in it, each word takes one line. In you program. Write Java code to read in words from the given file, then prompt the user for two words and print out how many words in the file fall between those words. If one of the two words is not contained in the file, then tell word1 or word 2 is not found in the file.

output:

Please type in the two words: good and night

good or night is not found.

output:

Please type in the two words: hello and computer

There are 1234 words between hello and computer

Hint: you can use binarySearch method to figure out the index for the two words

The word.txt file isn't provided here but i am having a tough time implementing code to perform the required action. Any help is greatly appreciated!

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

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions