I am working on a circle class that stores the center point
I am working on a circle class that stores the center point and radius in a circle object
import java.awt.Point;
public class Circle extends Shape{
private double radius;
protected Circle(Point aCenter, double aradius){
super(\"Circle\");
//this is the part I am having issues with, my super class \"Shape has setPoints set up to receive Point[] instead of Point and it says it is an inapplicable argument. any help would be appreciated.
setPoints(aCenter);
if(aradius>=0){
this.radius=aradius;
}else radius=0.0;
}
public double getRadius(){
return this.radius;
}
public double getPerimeter(){
return 2*3.14*radius;
}
public double getArea(){
return 3.14*radius*radius*radius;
}
}
Solution
Passing an invalid type to function would result in inapplicable argument.
You cannot pass an object in place of array of objects.
Try to replace the setPoints(aCircle) with
setPoints(new Point[]{aCenter});
This statement will create a array of points with just a single element and passes it to setPoints.
