Write Javadoc comments for the class, constructor, and member functions. Annotat
ID: 3585786 • Letter: W
Question
Write Javadoc comments for the class, constructor, and member functions.
Annotations for function arguments and return types should be included.
public class Circle extends Shape2D {
static final double PI = 3.14159265;
public Circle(double r) {
radius = r;
}
public double getArea() {
return PI * radius * radius;
}
public double getRadius() {
return radius;
}
public void setRadius(double r) {
this.radius = r;
}
protected double radius;
}
Explanation / Answer
/* Circle Class which calculate the area of the circle
* @author
* @version
* @since
*/
public class Circle extends Shape2D {
/* Declaring constant */
static final double PI = 3.14159265;
/*
* Parameterized constructor
* @params double type
*/
public Circle(double r) {
radius = r;
}
/*
* This method will calculate the area of the Circle
* @params void
* @return double type
*/
public double getArea() {
return PI * radius * radius;
}
/*
* This method will return the radius of the Circle
* @params void
* @return double type
*/
public double getRadius() {
return radius;
}
/*
* This method will set the radius of the Circle to instance variable
* @params double type
* @return void
*/
public void setRadius(double r) {
this.radius = r;
}
/*
* Declaring instance variables
*/
protected double radius;
}
_____________Could you rate me well.Plz .Thank You
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.