- /* Mr. Rogers' Boolean Work Sheet,
11/14/2011 */
- import java.awt.* ;
- import
java.awt.event.* ;
- class
BooleanQuestions {
-
public static void main ( ) {
-
boolean a = true, b = false,
c = true, booleanAnswer ;
-
int x = 0, i = 2, j = 3, k = 4 ;
-
//////////////////////////////////////////////////////////////////////////////////////////
-
/* _____ 1 */ booleanAnswer = a || b && i < j &&
j > k ;
-
System.out.println ( ++x + ") " + booleanAnswer ) ;
-
-
/* _____ 2 */ booleanAnswer = a && b && i <
j && j > k ;
-
System.out.println ( ++x + ") " + booleanAnswer ) ;
-
-
/* _____ 3 */ booleanAnswer = i / j < k ||
c && b || k % 2 <= j ;
-
System.out.println ( ++x + ") " + booleanAnswer ) ;
-
-
/* _____ 4 */ booleanAnswer = !a || b || j
== k && j != (k - 1) ;
-
System.out.println ( ++x + ") " + booleanAnswer ) ;
-
-
/* _____ 5 */ booleanAnswer = !(a || b ||
c) && a && i >= k * i % 2 ;
-
System.out.println ( ++x + ") " + booleanAnswer ) ;
-
-
/* _____ 6 */ booleanAnswer = ! ( (b || a) &&
(a || (c && (a && (k <= j / i ) ) ) ) ) ;
-
System.out.println ( ++x + ") " + booleanAnswer ) ;
-
-
/* _____ 7 */ booleanAnswer = !!!(!a && !(b
&& !c));
-
System.out.println ( ++x + ") " + booleanAnswer ) ;
-
-
/* _____ 8 */ booleanAnswer = k != i * 2 /
j % 2 && b ;
-
System.out.println ( ++x + ") " + booleanAnswer ) ;
-
-
/* _____ 9 */ booleanAnswer = b && (! ( (b ||
a) && (a && (!c || (a || (k <= j / i ) ) ) ) ) ) ;
-
System.out.println ( ++x + ") " + booleanAnswer ) ;
-
-
/* _____ 10 */ booleanAnswer = (b || a) &&
c && i == j % 2 + 1 ;
-
System.out.println ( ++x + ") " + booleanAnswer ) ;
- }
- }