Java Math Class Methods
Consider the following incomplete method mathOperations.
public static double mathOperations(double x, double y, double z) {
/* missing statement */
return result;
}
The method is intended to work as shown in these examples:
- A call to
mathOperations(25, 3, -10)should return55.0. - A call to
mathOperations(36, 2, -5)should return29.0.
Which of the following statements can replace /* missing statement */ so that the method works as intended?
A
double result = Math.sqrt(x) + Math.pow(y, 2) + Math.abs(z);
B
double result = Math.pow(x, y) - Math.abs(z);
C
double result = Math.sqrt(x) * Math.pow(y, 2) + Math.abs(z);
D
double result = x + y - z * Math.abs(y);
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | demosolasis1 | 1 | 1 | 0m 52s | 48 |
| #2 | theofanusmischa | 1 | 1 | 1m 07s | 33 |
| #3 | keithy.mcbeefy | 1 | 1 | 1m 31s | 9 |
| #4 | 108185265 | 0 | 2 | 0m 00s | -20 |
| #5 | thamminenigamya | 1 | 1 | 3m 45s | -125 |
Items per page:
10
1 – 5 of 5
APFIVE