Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given pre-condition: x = v1, y = v2 What statements must be executed for the pos

ID: 3768445 • Letter: G

Question

Given pre-condition: x = v1, y = v2

What statements must be executed for the post-condition, z = max(abs(v1), abs(v2))?

1:

// Pre-condition: x = v1, y = v2

x1 = Math.abs(x);

y1 = Math.abs(y);

if (x1 > y1) return x1; else return y1;

2:

// Pre-condition: x = v1, y = v2

if (x > y) return x; else return y;

3:

// Pre-condition: x = v1, y = v2

if (x > y) return Math.abs.(x) ; else return Math.abs(y);

4:

// Pre-condition: x = v1, y = v2

x1 = Math.abs(x);

y1 = Math.abs(y);

if (y1 > x1) return x1; else return y1;

// Pre-condition: x = v1, y = v2

x1 = Math.abs(x);

y1 = Math.abs(y);

if (x1 > y1) return x1; else return y1;

Explanation / Answer

// Pre-condition: x = v1, y = v2

x1 = Math.abs(x);

y1 = Math.abs(y);

if (x1 > y1) return x1; else return y1;

These statements must be executed.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote