subject

The following program contains 6 errors. correct the errors and submit a working version of the program. the corrected version of the program should produce the following output:
lines: 5
words: 21
when it is run on the following input file, example. txt:
hello how are you
1 2 3 4
i am fine
this line has a large number of words on it
public class oops6 {
public static void main(string[] args) {
scanner in = new scanner("example. txt");
countwords(in);
}
// counts total lines and words in the input scanner.
public static void countwords(scanner input) {
scanner input = new scanner("example. txt");
int linecount = 0;
int wordcount = 0;
while (input. {
string line = input. line(); // read one line
linecount++;
while (line. { // tokens in line
string word = line. hasnext;
wordcount++;
}
}
system. out. println("lines: " + linecount);
system. out. println("words: " + wordcount);
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:40
Design a pos circuit that displays the letters a through j on a seven-segment indicator. the circuit has four inputs w, x, y, and z which represent the last 4 bits of the uppercase ascii code for the letter to be displayed. thus, if wxyz = 0001 then "a" will be displayed. (any answer with 22 or fewer gates and inverters, not counting any for the inputs, is acceptable)
Answers: 2
question
Computers and Technology, 23.06.2019 14:00
In which job role will you be creating e-papers, newsletters and preiodicals
Answers: 1
question
Computers and Technology, 24.06.2019 00:00
Afashion designer wants to increase awareness about her brand. which network can she use and why she can use the blank to blank her products online. answers for the first blank: internet, extranet, or intranet answers for the second blank: market, design, and export
Answers: 1
question
Computers and Technology, 24.06.2019 12:30
Why does the pc send out a broadcast arp prior to sending the first ping request
Answers: 1
You know the right answer?
The following program contains 6 errors. correct the errors and submit a working version of the prog...
Questions
question
Biology, 06.05.2020 20:36
Questions on the website: 13722361