Presentation is loading. Please wait.

Presentation is loading. Please wait.

Output Programs These slides will present a variety of small programs. Each program has a compound condition which uses the Boolean Logic that was introduced.

Similar presentations


Presentation on theme: "Output Programs These slides will present a variety of small programs. Each program has a compound condition which uses the Boolean Logic that was introduced."— Presentation transcript:

1

2 Output Programs These slides will present a variety of small programs. Each program has a compound condition which uses the Boolean Logic that was introduced in this chapter. Our concern will be with the output of each program, and more importantly, develop some methods to determine program output correctly, for programs that contain compound conditions. You can expect that on quizzes and/or tests only a program segment or a method is shown.

3 Teacher/Student Versions, Tablet PCs, and Inking The “For Teachers” version of this presentation has 2 slides for each program. The first slide only shows the program. The second shows the program, worked out solution, and output. The “For Students” version only has 1 slide for each program with no provided solution or output. Students are expected to work out the solutions either on paper, or ideally they can “ink” directly on their laptops.

4 public class Output1001 { public static void main(String args[]) { int x = 10; int y = 20; int z = 30; if (x z) System.out.println("Hello"); else System.out.println("Goodbye"); }

5 public class Output1002 { public static void main(String args[]) { int x = 10; int y = 20; int z = 30; if (x z) System.out.println("Hello"); else System.out.println("Goodbye"); }

6 public class Output1003 { public static void main(String args[]) { int x = 10; int y = 20; int z = 30; if (x < y && y < z) System.out.println("Hello"); else System.out.println("Goodbye"); }

7 public class Output1004 { public static void main(String args[]) { int x = 10; int y = 20; int z = 30; if (x < y || y < z) System.out.println("Hello"); else System.out.println("Goodbye"); }

8 public class Output1005 { public static void main(String args[]) { int x = 10; int y = 20; int z = 20; if (x == y || y == z) System.out.println("Hello"); else System.out.println("Goodbye"); }

9 public class Output1006 { public static void main(String args[]) { int x = 10; int y = 20; int z = 20; if (x == y && y == z) System.out.println("Hello"); else System.out.println("Goodbye"); }

10 public class Output1007 { public static void main(String args[]) { int x = 20; int y = 20; int z = 20; if (x == y && y == z) System.out.println("Hello"); else System.out.println("Goodbye"); }

11 public class Output1008 { public static void main(String args[]) { int x = 20; int y = 20; int z = 20; if (x == y || y == z) System.out.println("Hello"); else System.out.println("Goodbye"); }

12 public class Output1009 { public static void main(String args[]) { int x = 10; int y = 20; int z = 30; if (x == y || y == z) System.out.println("Hello"); else System.out.println("Goodbye"); }

13 public class Output1010 { public static void main(String args[]) { int x = 10; int y = 20; int z = 30; if (x == y && y == z) System.out.println("Hello"); else System.out.println("Goodbye"); }

14 public class Output1011 { public static void main(String args[]) { int x = 10; int y = 20; int z = 30; while (x < y && y < z) { x++; z--; } System.out.println(x); System.out.println(y); System.out.println(z); }

15 public class Output1012 { public static void main(String args[]) { int x = 10; int y = 20; int z = 30; while (x < y || y < z) { x+=3; z-=2; } System.out.println(x); System.out.println(y); System.out.println(z); }

16 public class Output1013 { public static void main(String args[]) { int x = 10; int y = 20; int z = 30; while (x < y && y != z) { x*=2; z--; } System.out.println(x); System.out.println(y); System.out.println(z); }

17 public class Output1014 { public static void main(String args[]) { int x = 10; int y = 20; int z = 30; while (x < y || y != z) { x*=2; z-=5; } System.out.println(x); System.out.println(y); System.out.println(z); }

18 public class Output1015 { public static void main(String args[]) { int x = 10; int y = 20; int z = 30; while (x + y z) { x*=2; z-=5; } System.out.println(x); System.out.println(y); System.out.println(z); }


Download ppt "Output Programs These slides will present a variety of small programs. Each program has a compound condition which uses the Boolean Logic that was introduced."

Similar presentations


Ads by Google