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, 23.06.2019 17:00
What does the faves button do? a. users mark a web page as a favorite b. leads other readers to favor a specific page c. readers sort and align their favicons, or favorite icons d. leads users to a message board where they can post questions
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
Which of the following characters is acceptable to use in a filename? ? / – %
Answers: 1
question
Computers and Technology, 24.06.2019 17:50
You work in the accounting department and have been using a network drive to post excel workbook files to your file server as you complete them. when you attempt to save a workbook file to the drive, you see the error message: “you do not have access to the folder ‘j: \’. see your administrator for access to this folder.” what should you do first
Answers: 2
question
Computers and Technology, 24.06.2019 22:10
Function name: poly parameters: int returns: int description: a polynomial of degree n with coefficients a0,a1,a2,a3, . . ,an is the function p(x) = a0+a1x+a2x2+a3 ∗ x3+ . . +an ∗ xn this function can be evaluated at different values of x. for example, if: p(x) = 1+2x+ x2, then p(2) = 1+2 ∗ 2+22 = 9. if p(x) = 1+x2+x4, then p(2) = 21 and p(3) = 91. write a function poly() that takes as input a list of coefficients a0, a1, a2, a3, . . , an of a polynomial p(x) and a value x. the function will return poly(x), which is the value of the polynomial when evaluated at x.
Answers: 3
You know the right answer?
The following program contains 6 errors. correct the errors and submit a working version of the prog...
Questions
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
question
Mathematics, 10.09.2020 07:01
Questions on the website: 13722362