Consider the squareRoot method defined below:
/** @param d a real number such that d >= 0
* Postcondition: Returns a Double whose value is the square
* root of the value represented by d.
*/
public Double squareRoot(Double d)
{
/* implementation code */
}
Which /* implementation code */ satisfies the postcondition?
I) double x = d.doubleValue();
x = Math.sqrt(x);
return new Double(x);
II) return new Double(Math.sqrt(d.doubleValue()));
III) return (Double) Math.sqrt(d.doubleValue());
(A) I only
(B) I and II only
(C) I and III only
(D) II and III only
(E) I, II, and III