Question: Previously, we created a Circle class. Can you extend this to write the getArea() method using the static method Math.pow instead? public class Circle {
Previously, we created a Circle class. Can you extend this to write the getArea() method using the static method Math.pow instead?
public class Circle { private static final double PI = 3.14159265359; private double radius; public Circle(double theRadius) { radius = theRadius; }
// Change the implementation of this method. public double getArea() { return Math.PI * Math.pow(radius, 2); } }
Not sure what I did wrong.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
