Question: Every circle has a center and radius. Given the radius, we can determine the circle's area and circumference. Given the center, we can determine its

Every circle has a center and radius. Given the radius, we can determine the circle's area and circumference. Given the center, we can determine its position in the x-y plane. The center of a circle is a point in the x-y plane. Design the class Circle that can store the radius and center of the circle. Here is my code so far

package circle;

public class Circle {

public static void main(String args[]) {

Circle circle = new Circle(2,3,5);

System.out.println(circle);

//Represents center

private int x,y;

//Represents radius

private double radius;

public Circle(int x, int y, double radius) {

this.x = x;

this.y = y;

this.radius = radius;

}

public int getX() {

return x;

}

public void setX(int x) {

this.x = x;

}

public int getY() {

return y;

}

public void setY(int y) {

this.y = y;

}

public double getRadius() {

return radius;

}

public void setRadius(double radius) {

this.radius = radius;

}

}

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!