Computers and Technology

(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>

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 13:30, holyturnley
Hola, me podrian resolver estos ejercicios en php? ejercicio1: crear una pagina que permita realizar una conversion monteria: nuevos soles, dolares, euros. se debe seleccionar el valor monetario origen y conversion asi como tambien el monto a convertir ejercicio2: crear un pagina que muestre la tabla de sumar de un rango de numeros ingresados por teclado. ejercicio3: ingresar una palabra y mostrar la escritura del final al inicio ejercicio4: ingresar la fecha de nacimiento de una persona y determinar, cuantos años, meses y dias tiene ejercicio5: ingresar un rango de valor numerico y mostrar, los numeros pares, impares y primos.
Answers: 1
image
Computers and Technology, 22.06.2019 01:40, genyjoannerubiera
Kali, a python programmer, is using the turtle module to write the word “hello.” which code should she use to indicate the location to begin writing the word? a # pick up the turtle and move it to its starting location. b penup(-100, 200) goto() pendown() c penup() goto(-100, 200) pendown() d # pick up the turtle and move it to (-100, 200)
Answers: 2
image
Computers and Technology, 22.06.2019 06:30, lilpeepxliltracy
This technology is used to produce high-quality documents that look good on the computer screen and in print.
Answers: 1
image
Computers and Technology, 22.06.2019 11:00, simbupls
Technician a says that the radiator usually cools better if the front air dam is removed. technician b says that when a condenser has a leak it can be repaired easily with epoxy. who is correct?
Answers: 1
Do you know the correct 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:

Konu
Mathematics, 15.04.2021 01:00
Konu
Mathematics, 15.04.2021 01:00
Konu
Mathematics, 15.04.2021 01:00