Assertions
Category: Assertions
Author: Benson Limketkai
Book Chapter: 5.5
Problem: Assertions
never true or sometimes true / sometimes false.
public static void mystery(Scanner input) {
System.out.print("Enter a positive number: ");
int num = input.nextInt();
int z = num;
int a = 0;
<span class="assertionpoint">// Point A
while (z > 0) {
<span class="assertionpoint">// Point B
if (a < z) {
<span class="assertionpoint">// Point C
a++;
} else {
z--;
}
num = z + 1;
<span class="assertionpoint">// Point D
}
<span class="assertionpoint">// Point E
}
1) z > 0
2) num > 0
3) a < z