/* Assertions Motivation: Analogy: Why study physics to build a bridge? Need to understand physical world we are working in order to build something that won't fall apart. ---- CSE: math & logic is what drives our world. It is how we understand the "virtual world" Helpful for: - Program verification - Assertions This will also be a Midterm question! */ public class Assert1 { // assume y >= 0 public static void mystery(int x, int y) { int z = 0; // Point A // x = 1, y = 1, z = 0 while (x >= y) { // (x < y) // Point B x = x - y; // Point C z++; // Point D } // Point E if (x < y) { System.out.println(z + " " + x); } } /* Fill in the table below with the words ALWAYS, NEVER or SOMETIMES. x < y x == y z == 0 +---------------------+---------------------+---------------------+ Point A | S | S | A | +---------------------+---------------------+---------------------+ Point B | N | S | S | +---------------------+---------------------+---------------------+ Point C | S | S | S | +---------------------+---------------------+---------------------+ Point D | S | S | N | +---------------------+---------------------+---------------------+ Point E | A | N | S | +---------------------+---------------------+---------------------+ */