Many applications possess a word search facility that will parse a text file to identify the presence of a given word. You are required to write a Java application using Netbeans that will open a text file of prose and search for a target word input by the user.  The Search functionality would be done int two ways:  1.    Search for the number of occurrences of the word. For example, if the user types ‘the’, the program should print out the number of times the word the appears in the text.2.    A wildcard search.A wildcard could be used to represent one or more multiple characters at the beginning or end of a word, and/or as a direct replacement for a single character. For example, if the text contained the words ‘shape’, ‘tape’ and ‘hate’, then queried string ‘*ape’ would return ‘shape’ and ‘tape’, whilst ‘s*ape’ could only return ‘shape’. Perhaps leading, trailing and single letter substitution wildcards can be made allowable within the same single word search. A text file is available (Immortality.txt) as an example input file for use with your application.  Here is the text file:   "There was a time when meadow, grove, and stream,The earth, and every common sight,To me did seemAppareled in celestial light,"The glory and the freshness of a dream.It is not now as it hath been of yoreTurn wheresoe'er I may,By night or day.The things which I have seen I now can see no more. The Rainbow comes and goes,And lovely is the Rose,The Moon doth with delightLook round her when the heavens are bare,Waters on a starry nightAre beautiful and fairThe sunshine is a glorious birthBut yet I know, where'er I go,That there hath past away a glory from the earth.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

Many applications possess a word search facility that will parse a text file to identify the presence of a given word. You are required to write a Java application using Netbeans that will open a text file of prose and search for a target word input by the user.  
The Search functionality would be done int two ways: 

1.    Search for the number of occurrences of the word. For example, if the user types ‘the’, the program should print out the number of times the word the appears in the text.
2.    A wildcard search.A wildcard could be used to represent one or more multiple characters at the beginning or end of a word, and/or as a direct replacement for a single character. For example, if the text contained the words ‘shape’, ‘tape’ and ‘hate’, then queried string ‘*ape’ would return ‘shape’ and ‘tape’, whilst ‘s*ape’ could only return ‘shape’. Perhaps leading, trailing and single letter substitution wildcards can be made allowable within the same single word search.

A text file is available (Immortality.txt) as an example input file for use with your application.  Here is the text file:

 

"There was a time when meadow, grove, and stream,
The earth, and every common sight,
To me did seem
Appareled in celestial light,"
The glory and the freshness of a dream.
It is not now as it hath been of yore
Turn wheresoe'er I may,
By night or day.
The things which I have seen I now can see no more.

The Rainbow comes and goes,
And lovely is the Rose,
The Moon doth with delight
Look round her when the heavens are bare,
Waters on a starry night
Are beautiful and fair
The sunshine is a glorious birth
But yet I know, where'er I go,
That there hath past away a glory from the earth.

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT