SO I NEED INPUTTING THIS FILE FOR THE OUTPUT TO BE THE SAME AS THE INCLUDED DOCUMENT. I POSTED THE FILE AT THE BOTTOM OF THE CODE TOO. import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Scanner; public class WordCount { //______________________ public static ArrayList readFile(String fileName) throws FileNotFoundException { ArrayList list=new ArrayList(); File file=new File(fileName); Scanner sc=new Scanner(file); String word; while(sc.hasNext()) { word=sc.next(); list.add(word); } sc.close(); return list; } //______________________ public static int differentWords(ArrayList list) { for(int i=0;i list) { int i,j; String key; int n=list.size(); for (i = 1; i < n; i++) { key = list.get(i); j = i - 1; while (j >= 0 && list.get(j).compareTo(key)>0) { list.set(j+1, list.get(j)); j = j - 1; } list.set(j+1, key); } } //______________________ public static void findWord(String word,String fileName) throws FileNotFoundException{ File file=new File(fileName); Scanner sc=new Scanner(file); boolean flag=false; String str; int lineNo=1; while(sc.hasNextLine()) { str=sc.nextLine(); String arr[]=str.split(" "); for(int i=0;i list=readFile(args[0]); String word; Scanner sc=new Scanner(System.in); System.out.println("The total number of words in the file is: "+list.size()); System.out.println("The total number of different words in the file is: "+differentWords(list)); System.out.println("Words of the file in ascending order without duplication:"); sort(list); System.out.println(list); do { System.out.print("Please enter a word to be searhed: "); word=sc.nextLine(); if(word.compareTo("EINPUT")==0) break; findWord(word,args[0]); }while(true); System.out.println("Bye!"); } }     FILE: James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991.[23] Java was originally designed for interactive television, but it was too advanced for the digital cable television industry at the time.[24] The language was initially called Oak after an oak tree that stood outside Gosling's office. Later the project went by the name Green and was finally renamed Java, from Java coffee, the coffee from Indonesia.[25] Gosling designed Java with a C/C++-style syntax that system and application programmers would find familiar.[26] Sun Microsystems released the first public implementation as Java 1.0 in 1996.[27] It promised Write Once, Run Anywhere (WORA) functionality, providing no-cost run-times on popular platforms. Fairly secure and featuring configurable security, it allowed network- and file-access restrictions. Major web browsers soon incorporated the ability to run Java applets within web pages, and Java quickly became popular. The Java 1.0 compiler was re-written in Java by Arthur van Hoff to comply strictly with the Java 1.0 language specification.[28] With the advent of Java 2 (released initially as J2SE 1.2 in December 1998 – 1999), new versions had multiple configurations built for different types of platforms. J2EE included technologies and APIs for enterprise applications typically run in server environments, while J2ME featured APIs optimized for mobile applications. The desktop version was renamed J2SE. In 2006, for marketing purposes, Sun renamed new J2 versions as Java EE, Java ME, and Java SE, respectively

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

SO I NEED INPUTTING THIS FILE FOR THE OUTPUT TO BE THE SAME AS THE INCLUDED DOCUMENT. I POSTED THE FILE AT THE BOTTOM OF THE CODE TOO.

import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;

public class WordCount {
//______________________
public static ArrayList<String> readFile(String fileName) throws FileNotFoundException {
ArrayList<String> list=new ArrayList<String>();
File file=new File(fileName);
Scanner sc=new Scanner(file);
String word;

while(sc.hasNext()) {
word=sc.next();
list.add(word);
}
sc.close();
return list;
}
//______________________
public static int differentWords(ArrayList<String> list) {
for(int i=0;i<list.size();i++) {
for(int j=0;j<list.size();j++) {
if(list.get(i).equals(list.get(j)))
list.remove(j);
}
}
return list.size();
}
//_______________________
public static void sort(ArrayList<String> list) {
int i,j;
String key;
int n=list.size();
for (i = 1; i < n; i++)
{
key = list.get(i);
j = i - 1;
while (j >= 0 && list.get(j).compareTo(key)>0)
{
list.set(j+1, list.get(j));
j = j - 1;
}
list.set(j+1, key);
}
}
//______________________
public static void findWord(String word,String fileName) throws FileNotFoundException{
File file=new File(fileName);
Scanner sc=new Scanner(file);
boolean flag=false;
String str;
int lineNo=1;
while(sc.hasNextLine()) {
str=sc.nextLine();
String arr[]=str.split(" ");
for(int i=0;i<arr.length;i++) {
if(arr[i].compareTo(word)==0) {
flag=true;
System.out.println("Line number "+lineNo);
System.out.println(str);
break;
}
}
lineNo++;
}
if(!flag) {
System.out.println("The word "+word+" is not found in the text file");
}
sc.close();
}

public static void main(String[] args) throws FileNotFoundException {
ArrayList<String> list=readFile(args[0]);
String word;
Scanner sc=new Scanner(System.in);
System.out.println("The total number of words in the file is: "+list.size());
System.out.println("The total number of different words in the file is: "+differentWords(list));
System.out.println("Words of the file in ascending order without duplication:");
sort(list);
System.out.println(list);
do {
System.out.print("Please enter a word to be searhed: ");
word=sc.nextLine();
if(word.compareTo("EINPUT")==0)
break;
findWord(word,args[0]);
}while(true);
System.out.println("Bye!");
}

}

 

 

FILE:

James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991.[23] Java was originally designed for interactive television, but it was too advanced for the digital cable television industry at the time.[24] The language was initially called Oak after an oak tree that stood outside Gosling's office. Later the project went by the name Green and was finally renamed Java, from Java coffee, the coffee from Indonesia.[25] Gosling designed Java with a C/C++-style syntax that system and application programmers would find familiar.[26]

Sun Microsystems released the first public implementation as Java 1.0 in 1996.[27] It promised Write Once, Run Anywhere (WORA) functionality, providing no-cost run-times on popular platforms. Fairly secure and featuring configurable security, it allowed network- and file-access restrictions. Major web browsers soon incorporated the ability to run Java applets within web pages, and Java quickly became popular. The Java 1.0 compiler was re-written in Java by Arthur van Hoff to comply strictly with the Java 1.0 language specification.[28] With the advent of Java 2 (released initially as J2SE 1.2 in December 1998 – 1999), new versions had multiple configurations built for different types of platforms. J2EE included technologies and APIs for enterprise applications typically run in server environments, while J2ME featured APIs optimized for mobile applications. The desktop version was renamed J2SE. In 2006, for marketing purposes, Sun renamed new J2 versions as Java EE, Java ME, and Java SE, respectively

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
James Gosling, Mike Sheridan, and Patrick Naughton initiated
the Java language project in June 1991. [23] Java was originally
designed for interactive television, but it was t0o advanced
for the digital cable television industry at the time. [24] The
language was initially called Oak after an oak tree that stood
outside Gosling's office. Later the project went by the name
Green and was finally renamed Java, from Java coffee, the
coffee from Indonesia. [25] Gosling designed Java with a
C/C++-style syntax that system and application programmers
would find familiar. [26]
Sun Microsystems released the first public implementation as
Java 1.0 in 1996. [27] It promised Write Once, Run Anywhere
(WORA) functionality, providing no-cost run-times on popular
platforms. Fairly secure and featuring configurable security,
it allowed network- and file-access restrictions. Major web
browsers soon incorporated the ability to run Java applets
within web pages, and Java quickly became popular. The Java 1.0
compiler was re-written in Java by Arthur van Hoff to comply
strictly with the Java 1.0 language specification. [28] With the
advent of Java 2 (released initially as J2SE 1.2 in December
1998 â€" 1999), new versions had multiple configurations built
for different types of platforms. J2EE included technologies
and APIS for enterprise applications typically run in server
environments, while J2ME featured APIS optimized for mobile
applications. The desktop version was renamed J2SE. In 2006,
for marketing purposes, Sun renamed new J2 versions as Java EE,
Java ME, and Java SE, respectively.
Transcribed Image Text:James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. [23] Java was originally designed for interactive television, but it was t0o advanced for the digital cable television industry at the time. [24] The language was initially called Oak after an oak tree that stood outside Gosling's office. Later the project went by the name Green and was finally renamed Java, from Java coffee, the coffee from Indonesia. [25] Gosling designed Java with a C/C++-style syntax that system and application programmers would find familiar. [26] Sun Microsystems released the first public implementation as Java 1.0 in 1996. [27] It promised Write Once, Run Anywhere (WORA) functionality, providing no-cost run-times on popular platforms. Fairly secure and featuring configurable security, it allowed network- and file-access restrictions. Major web browsers soon incorporated the ability to run Java applets within web pages, and Java quickly became popular. The Java 1.0 compiler was re-written in Java by Arthur van Hoff to comply strictly with the Java 1.0 language specification. [28] With the advent of Java 2 (released initially as J2SE 1.2 in December 1998 â€" 1999), new versions had multiple configurations built for different types of platforms. J2EE included technologies and APIS for enterprise applications typically run in server environments, while J2ME featured APIS optimized for mobile applications. The desktop version was renamed J2SE. In 2006, for marketing purposes, Sun renamed new J2 versions as Java EE, Java ME, and Java SE, respectively.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Constants and Variables
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
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