logo CodeStepByStep logo

surveys2

Write a method named surveys2 (similar to the previous exercise, surveys) that finds the sum of answers given to a collection of surveys as described below. The difference between this and the previous exercise is that in this one, you must find the count of letters that are present in ALL lines of a given clump. For example, if the file named surveys.txt contains the following:

ab
ac

xyz
y
k

defg

The first clump contains 1 letter on every line: a. The second clump contains no letters that are present on every line. The third clump contains 4 letters that are present on every line (the only line in the clump): d, e, f, and g. So the call of surveys2("surveys.txt") should return 1 + 0 + 4 = 5.

Method: Write a Java method as described, not a complete program or class.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.