Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am working on a circle class that stores the center point and radius in a circ

ID: 3926052 • Letter: I

Question

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;
}
}

Explanation / Answer

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.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote