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 10:00
Create a word problem that involves calculating the volume and surface area of a three-dimensional object. cube: surface area 6 s2 , volume s3
Answers: 3
question
Computers and Technology, 22.06.2019 18:00
Suppose an astronomer discovers a large, spherical-shaped body orbiting the sun. the body is composed mostly of rock, and there are no other bodies sharing its orbit. what is the best way to categorize this body? a. planet b. moon c. comet d. asteroid
Answers: 1
question
Computers and Technology, 22.06.2019 23:30
For her science class, elaine is creating a presentation on weather in the united states. she wants to make the presentation beautiful and interesting by drawing simple cloud or wave shapes. which is the best way for elaine to draw these shapes?
Answers: 1
question
Computers and Technology, 23.06.2019 04:31
Type the correct answer in the box. spell all words correctly. the managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an
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
Physics, 12.05.2021 22:00
question
Mathematics, 12.05.2021 22:00
question
Mathematics, 12.05.2021 22:00
question
History, 12.05.2021 22:00
question
Business, 12.05.2021 22:00
question
Mathematics, 12.05.2021 22:00
Questions on the website: 13722361