Question: Consider the following method, which is intended to return the product of 3 and the nonnegative difference between two int parameters. public int threeTimesDiff(int num1,
Consider the following method, which is intended to return the product of 3 and the nonnegative difference between two int parameters.
public int threeTimesDiff(int num1, int num2) { return 3 * (num1 - num2); } Which precondition is required so that the method works as intended for all values of the parameters that satisfy the precondition?
-
num1 > 0, num2 > 0
-
num1 >= 0, num2 >= 0
-
num1 >= num2
-
num2 >= num1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
