Consider the following method for converting milliseconds into days:
// converts milliseconds to days public static double toDays(double millis) { return millis / 1000.0 / 60.0 / 60.0 / 24.0; }
Write a similar method named area
that takes as a parameter the radius of a circle and that returns the area of the circle.
For example, the call area(2.0)
should return 12.566370614359172
.
Recall that area can be computed as π times the radius squared and that Java has a constant called Math.PI
.