Create a public class EvenOddFlip
.
It should provide a single constructor accepting an int
, which sets the initial state of the instance.
Provide two instance methods.
setValue
accepts a single int
and updates the stored value.
You should assert
that the value passed to setValue
is even if the current value is odd, and odd if the current
value is even.isEven
retrieves whether the current saved value is even.Here's an example of how your class should work:
You're challenge is to write tests for this problem described above.
Stuck? You may find these lessons helpful: