Week 9
Class Activity
## Complex Class For these activities you will be using this [__`Complex`__](Complex.java) class. ## Activity 1 Implement a method, `getReal()`, that accepts a `List<Complex>` and returns a list of all the complex numbers where the imaginary component is zero. ## Activity 2 Write a class, `IsReal`, that implements the [`Predicate<Complex>`](http://javadoc.taylorial.com/java.base/util/function/Predicate.html) interface. The `test()` method must return `true` if and only if the imaginary component of the complex number is zero. ## Activity 3 Write a method, `getSpecified()`, that accepts a `List<Complex>` and a `Predicate<Complex>` and returns a list of all the complex numbers for which the predicate is true. ## Activity 4 Write a code snippet that calls `getSpecified()` using an `IsReal` object. Then rewrite the call using a lambda expression instead of an `IsReal` object. ## Activity 5 Write a code snippet that calls `getSpecified()` using a lambda expression that produces true whenever the magnitude of the complex number is greater than 27 for the predicate. ## Activity 6 Make use of a [`Stream`](http://javadoc.taylorial.com/java.base/util/stream/Stream.html) to generate the same list as required by the previous problem. You may not use `getSpecified()`. Instead you should use `Stream.filter()` and `Stream.collect()`. ## Activity 7 Use the `List.forEach()` method to display each complex number on a separate line. ## Activity 8 Make use of a `Stream` and `DoubleStream` to calculate the average angle, in degrees, of the complex numbers in a list. ## Activity 9 Write a program that reads all of the `Complex` numbers (one per line) out of the file [complexies.txt](complexies.txt) and calculates the average angle, in degrees, of all the complex numbers in the file.

[error: stat() failed!]