Write a program that will read sentences from a text file, placing each sentence in its own instance of ArrayList. (You will create a sentence object by adding words to it one at a time as they are read.) When a sentence has been completely read, add the sentence to another instance of ArrayList. Once you have read the entire file, you will have an instance of ArrayList that contains several instances of ArrayList, one for each sentence read. Now ask the user to enter a sentence number and a word number. Display the word that occurs in the given position. If the sentence number or word number is not valid, provide an appropriate error message.

What will be an ideal response?


See the code in WordInFile.java.

Computer Science & Information Technology

You might also like to view...

Which methods can be used to change the scrollbar policies?

a. setHoizontalPolicy, setVerticalPolicy. b. setHorizontal, setVertical. c. setHPolicy, setVPolicy. d. setHorizontalScrollBarPolicy, setVerticalScrollBarPolicy.

Computer Science & Information Technology

In OpenOffice Writer, the default font for a new document is Times New Roman

Indicate whether the statement is true or false

Computer Science & Information Technology

Searching through a linked list or inserting an item in a linked list requires a ____ of the list.

A. review B. deletion C. copying D. traversal

Computer Science & Information Technology

Whenever the user drags the knob of a JSlider, a(n) ____ is generated.

A. ConnectionEvent B. LineEvent C. MenuEvent D. ChangeEvent

Computer Science & Information Technology