

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


class Circle{ private double x; private double y; private double radius; public Circle(){ x=0; y=0; radius=1; } public Circle(double x, double y, double radius){ this.x=x; this.y=y; this.radius=radius; } public double getx(){ return x; } public double gety(){ return y; } public double getr(){ return radius; } public void setx(double x){ this.x=x;
public void sety(double y){ this.y=y; } public void setr(double radius){ this.radius=radius; } public double getArea(){ return (Math.PIradiusradius); } public double getPerimeter(){ return (2Math.PIradius); } public void print(){ System.out.println("Center of the circle = (" + x + "," + y + ")"); System.out.println("Radius length of the circle = " + radius); } boolean contains(double x1, double y1){ double d=Math.sqrt(Math.pow((x1-x),2)+Math.pow((y1-y),2)); return(d<radius); } } public class Test {