Pick one of the following and answer it. Write a method named getMin that takes
ID: 3701453 • Letter: P
Question
Pick one of the following and answer it.Write a method named getMin that takes two int parameters and returns the lesser of the two values (assume the two values will never be equal). Then write a second method getMin3 that takes 3 int parameters and returns the minimum of all three values (again assume none of the three parameters will be equal to each other). In your second method, be sure to call the first method (getMin) to accomplish the result.
or this one:
write a method that is called isEqual that takes two double values as parameters and returns true if they are essentially equal, meaning they are within 0.00001 of each other. Pick one of the following and answer it.
Write a method named getMin that takes two int parameters and returns the lesser of the two values (assume the two values will never be equal). Then write a second method getMin3 that takes 3 int parameters and returns the minimum of all three values (again assume none of the three parameters will be equal to each other). In your second method, be sure to call the first method (getMin) to accomplish the result.
or this one:
write a method that is called isEqual that takes two double values as parameters and returns true if they are essentially equal, meaning they are within 0.00001 of each other. Pick one of the following and answer it.
Write a method named getMin that takes two int parameters and returns the lesser of the two values (assume the two values will never be equal). Then write a second method getMin3 that takes 3 int parameters and returns the minimum of all three values (again assume none of the three parameters will be equal to each other). In your second method, be sure to call the first method (getMin) to accomplish the result.
or this one:
write a method that is called isEqual that takes two double values as parameters and returns true if they are essentially equal, meaning they are within 0.00001 of each other.
Explanation / Answer
public static int getMin(int x, int y) {
return (x > y) ? y : x;
}
public static int getMin3(int x, int y, int z) {
int t = (x > y) ? y : x;
return getMin(t, z); // calling first method
}