package uk.ac.liv.comp285.cw1.shapes;
import java.awt.Graphics;
import uk.ac.liv.comp285.cw1.Shape;
public class Circle extends Shape {
public Circle(float x, float y,float radius) {
super();
this.x = x;
this.y = y;
this.radius = radius;
}
private float x,y,radius; // x,y are centre of the circle
@Override
public float getArea() {
return((float)(Math.PI*radius*radius));
}
@Override
public Point getLowerLeftPoint() {
return(new Point(x-radius,y-radius));
}
@Override
public Point getUpperRightPoint() {
return(new Point(x+radius,y+radius));
}
@Override
public void render(Graphics g) {
g.drawArc((int)(x-radius),(int)(y-radius), (int)(radius*2), (int)(radius*2),0,360);
}
}