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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!