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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started