Examlex

Solved

Assertions
for the Following Method, Identify Each of the Three

question 7

Essay

Assertions
For the following method, identify each of the three assertions in the table below as being either ALWAYS true, NEVER true or SOMETIMES true / sometimes false at each labeled point in the code. You may abbreviate these choices as A/N/S respectively.
public static int mystery(Scanner console) {
int y = 0;
int z = 1;
int next = console.nextInt();
// Point A
while (next >= 0) {
// Point B
if (y > z) {
// Point C
z = y;
}
y++;
next = console.nextInt();
// Point D
}
// Point E
return z;
}
 next <0y>zy==0 Point A  Point B  Point C  Point D  Point E \begin{array}{|l|l|l|l|}\hline & \text { next }<0 & y>z & y==0 \\\hline \text { Point A } & & & \\\hline \text { Point B } & & & \\\hline \text { Point C } & & & \\\hline \text { Point D } & & & \\\hline \text { Point E } & & & \\\hline\end{array}


Definitions:

Lease Payments

Lease Payments are regular payments made by a lessee to a lessor for the use of an asset over a specified period.

Debt Obligation

A legally binding requirement to repay borrowed money, often including interest and the principal amount.

Related Questions