-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBooleanExpressions.java
More file actions
36 lines (31 loc) · 1.17 KB
/
BooleanExpressions.java
File metadata and controls
36 lines (31 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.util.Scanner;
public class BooleanExpressions {
public static void main(String[] args){
Scanner keyboard = new Scanner(System.in);
boolean a, b, c, d, e, f;
double x, y;
System.out.print("Give me two numbers. First: ");
x = keyboard.nextDouble();
System.out.print("Second: ");
y = keyboard.nextDouble();
a = (x < y);
b = (x <= y);
c = (x == y);
d = (x != y);
e = (x > y);
f = (x >= y);
System.out.println(x + " is LESS THAN " + y + ": " + a);
System.out.println( x + " is LESS THAN / EQUAL TO " + y + ": " + b );
System.out.println( x + " is EQUAL TO " + y + ": " + c );
System.out.println( x + " is NOT EQUAL TO " + y + ": " + d );
System.out.println( x + " is GREATER THAN " + y + ": " + e );
System.out.println( x + " is GREATER THAN / EQUAL TO " + y + ": " + f );
System.out.println();
System.out.println( !(x < y) + " " + (x >= y) );
System.out.println( !(x <= y) + " " + (x > y) );
System.out.println( !(x == y) + " " + (x != y) );
System.out.println( !(x != y) + " " + (x == y) );
System.out.println( !(x > y) + " " + (x <= y) );
System.out.println( !(x >= y) + " " + (x < y) );
}
}