Circle API
A Circle class has an instance variable radius. Write the code to declare the instance variable radius as a double. |
private double radius; |
|
Write the header of a constructor for the Circle class. This constructor takes no arguments. |
public Circle() |
|
Write the header of a constructor for the Circle class. This constructor takes one argument, a double called theRadius. |
public Circle(double theRadius) |
|
| Look at this code segment and then write the Javadoc comment to document the return value of the method. /**
Gets the perimeter of the Circle object
_____________________
*/
public double perimeter()
{
double result = 2 * Math.PI * radius;
return result;
}
|
@return the perimeter |
Don't worry if your answer was slightly different. |
| You need to declare your instance variables as _________ so that they can only be accessed by methods of the same class and not by methods of other classes. | private |