## BJP3 Self-Check 4.1: logicalTests

Language/Type: Java boolean logic expressions
Author: Will Beebe (on 2013/04/01)

Translate each of the following English statements into logical tests that could be used in an `if/else` statement. Write the appropriate logical test for each statement below. Assume that three `int` variables, `x`, `y`, and `z`, have already been declared.

(Note: This problem is currently not very well implemented in Practice-It. Right now our system is just checking whether your answer exactly matches our expected answer, but some other correct answers might be marked as incorrect even though they would work. We plan to improve the system in the future. Sorry for the inconvenience.)

 a. z is odd. b. z is not greater than y's square root. c. y is positive. d. Either x or y is even, and the other is odd. (Hint: Don't use && or ||.) e. y is a multiple of z. f. z is not zero. g. y is greater in magnitude than z. h. x and z are of opposite signs. i. y is a nonnegative one-digit number. j. z is nonnegative. k. x is even l. x is closer in value to y than z is.

You must log in before you can solve this problem.

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.