NEED HELP PLEASE! Write a Java program to read a text file (command line input for file name), process the text file and perform the following. Print the total number of words in the file. Print the total number of different words (case sensitive, meaning “We” and “we” are two different words) in the file. Print all words in ascending order (based on the ASCII code) without duplication. Write a pattern match method to find the location(s) of a specific word (a character string up to twelve characters, e.g. system). This method should return all line number(s) and location(s) of the word(s) found in the file. Print all line(s) with line number(s) of the file where the word is funds by invoking the method of 4). Under each output line indicate the location(s) of the first character of the matched word (refer to the output example below).

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

NEED HELP PLEASE!

Write a Java program to read a text file (command line input for file name), process the text file and perform the following.

  • Print the total number of words in the file.
  • Print the total number of different words (case sensitive, meaning “We” and “we” are two different words) in the file.
  • Print all words in ascending order (based on the ASCII code) without duplication.
  • Write a pattern match method to find the location(s) of a specific word (a character string up to twelve characters, e.g. system). This method should return all line number(s) and location(s) of the word(s) found in the file.
  • Print all line(s) with line number(s) of the file where the word is funds by invoking the method of 4). Under each output line indicate the location(s) of the first character of the matched word (refer to the output example below).
  • Empty lines are lines, they also have their own unique line numbers.
  • Repeat the pattern match (4 and 5 above) until user types in EINPUT.

A word is defined by any combination of alpha and numerical characters (starting with alpha character), all other characters are delimiters. Note: no word in the input text file will start with a numerical character.

Input

The name of the text file should be read in from the Command line arguments, the input text file has a maximum of 80 characters per line and the size of the text file is less than two pages.

Output (Example of execution of your program:)
java Project mytext.txt
The total number of word in the file is: 501
The total number of different words in the file is: 465
Words of the input file in ascending order without duplication:
// here are output of all words in ascending order without duplication
// (the content of this portion is subject to the input text file)
Please enter a word to be searched: system <Enter>
Line number 10
complete your computation a 64 bit processor system running Linux Operating System is
Line number 487
entițe system should be based on a complete software system infrastructure design.
Please enter a word to be searched: Phoenix <Enter>
The word Phoenix is not found in the text file.
Please enter a word to be searched: EINPUT <Enter>
Вye!
Note: the blue color text indicates user input and <Enter> means user hit the <Enter> key
Transcribed Image Text:Output (Example of execution of your program:) java Project mytext.txt The total number of word in the file is: 501 The total number of different words in the file is: 465 Words of the input file in ascending order without duplication: // here are output of all words in ascending order without duplication // (the content of this portion is subject to the input text file) Please enter a word to be searched: system <Enter> Line number 10 complete your computation a 64 bit processor system running Linux Operating System is Line number 487 entițe system should be based on a complete software system infrastructure design. Please enter a word to be searched: Phoenix <Enter> The word Phoenix is not found in the text file. Please enter a word to be searched: EINPUT <Enter> Вye! Note: the blue color text indicates user input and <Enter> means user hit the <Enter> key
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Files and Directory
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education