Class Circle

java.lang.Object
  extended by Circle

public class Circle
extends java.lang.Object


Constructor Summary
Circle()
          The diameter of the circle is 10cm by default.
Circle(double d)
          The circle can be initialized of other sizes.
 
Method Summary
 double calculatetCircumference()
          Calculate the circumference of the circle
 double getDiameter()
          Return the diameter of the circle
 double grow(double factor)
          Make the circle bigger
 double shrink(double factor)
          Make the circle smaller
 java.lang.String toString()
          Report the diameter of the circle by a string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Circle

public Circle()
The diameter of the circle is 10cm by default.


Circle

public Circle(double d)
The circle can be initialized of other sizes.

Parameters:
d - diameter of the new circle
Method Detail

grow

public double grow(double factor)
Make the circle bigger

Parameters:
factor - Centimetres to be added to the diameter
Returns:
updated diameter

shrink

public double shrink(double factor)
Make the circle smaller

Parameters:
factor - Centimetres to be subtracted from the diameter
Returns:
updated diameter

getDiameter

public double getDiameter()
Return the diameter of the circle

Returns:
current diameter

calculatetCircumference

public double calculatetCircumference()
Calculate the circumference of the circle

Returns:
circumference of the circle

toString

public java.lang.String toString()
Report the diameter of the circle by a string

Overrides:
toString in class java.lang.Object
Returns:
a sentence reporting the diameter of the circle