subject

(Count the occurrences of words in a text file) Rewrite Listing 21.9 to read the text from a text file. The text file is passed as a command-line argument. Words are delimited by whitespace characters, punctuation marks (, ; . : ?), quotation marks (' "), and parentheses. Count the words in a case-sensitive fashion (e. g., consider Good and good to be the same word). The words must start with a letter. Display the output of words in alphabetical order, with each word preceded by the number of times it occurs. I ran my version of the program solution on its own Java source file to produce the following sample output:
C:\Users\\Desktop>java CountOccurrenceOfWords CountOccurrenceOfWords. java
Display words and their count in ascending order of the words
1 a
1 alphabetical
1 an
2 and
3 args
2 as
1 ascending
1 catch
1 class
4 count
2 countoccurrenceofwords
1 create
1 display
1 else
3 entry
3 entryset
2 ex
1 exception
1 exit
1 file
2 filename
3 for
1 fullfilename
3 get
1 getkey
1 getvalue
1 hasnext
1 hold
5 i
3 if
2 import
2 in
3 input
2 int
1 io
3 java
6 key
3 length
2 line
1 main
3 map
1 matches
3 new
1 nextline
1 null
1 of
2 order
3 out
3 println
1 printstacktrace
2 public
2 put
2 scanner
1 set
1 split
1 static
5 string
4 system
2 the
1 their
1 to
1 tolowercase
2 tree
6 treemap
2 trim
1 try
1 util
1 value
1 void
1 while
9 words
C:\Users\\Desktop>

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 11:00, jaygamer37
What is the name of the sound effect that danny hears
Answers: 1
image
Computers and Technology, 24.06.2019 13:00, naomirice24
In a heat transfer course, we can derive the equation for the temperature distribution in a flat rectangular plate. in this example, we will look at a plate at steadystate with three sides being held at t1, and one side held at t2. the temperature for any location on the plate, t(x, y), can be calculated by where create a function (prob3_5) that will take inputs of vectors x and y in feet, scalar n, scalars l and w in feet and scalars t1 and t2 in degrees fahrenheit. it will output a matrix t which is the temperature of each x and y locations. t will have the number of columns equal to the number of elements in x and rows equal to the number of elements in y. though this can be done without loops (perhaps more efficiently), your program must use a nested loop.
Answers: 2
image
Computers and Technology, 24.06.2019 20:30, jalenevoyles
Which key should you press to leave the cell as it originally was? a. delete b. cancel c. backspace d. enter
Answers: 1
image
Computers and Technology, 25.06.2019 08:00, Jroc23
What are good colleges to apply to if you got like a 2.5 as a gpa? already got a call back from gcu at least its a start rt
Answers: 2
You know the right answer?
(Count the occurrences of words in a text file) Rewrite Listing 21.9 to read the text from a text fi...

Questions in other subjects: