filmov
tv
Java Practice It || 5.27 assertions1 || assertions, method with return, if statement, while loop

Показать описание
Problem:
Question:
For each of the five points labeled by comments, identify each of the assertions in the table below as either being always true, never true, or sometimes true / sometimes false. You may assume that no int values overflow their valid ranges.
public static int mystery(Scanner console, int x) {
int count = 0;
// Point A
while (y { x) {
// Point B
if (y == 0) {
count++;
// Point C
}
// Point D
}
// Point E
return count;
}
Fill in each box of the the table below with ALWAYS, NEVER or SOMETIMES.
Question:
For each of the five points labeled by comments, identify each of the assertions in the table below as either being always true, never true, or sometimes true / sometimes false. You may assume that no int values overflow their valid ranges.
public static int mystery(Scanner console, int x) {
int count = 0;
// Point A
while (y { x) {
// Point B
if (y == 0) {
count++;
// Point C
}
// Point D
}
// Point E
return count;
}
Fill in each box of the the table below with ALWAYS, NEVER or SOMETIMES.