// // Quiz5.java: solution to quiz 5 // import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.stream.IntStream; import java.util.stream.Stream; public class Quiz5 { public static void main(String[] args) { // .range returns a list of numbers from the start to the // finish - a good way to generate a list of numbers // (in this case, the range is 10000 to 19999) IntStream nums1 = IntStream.range(10000, 20000); // TODO: use stream operations (and lambda expressions) to count // the number of numbers in nums1 that are divisible by 7 long divisibleBy7 = System.out.println("Divisible by 7: " + divisibleBy7); IntStream nums2 = IntStream.range(0, 100); // TODO: use stream operations and lambda expressions to // map nums2 into squares and then take their sum long sqSum = System.out.println("Sum of squares for 0..100: " + sqSum); // read lines of input into wordStream: BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); Stream wordStream = in.lines(); // TODO: use stream operations (such as filter, forEach) to // print all strings which are longer than 4 letters, // one per line. You cannot use if, for, or while in your // answer. } }