Source of Circle.java


  1: /**
  2:    A class that represents a circle.
  3:    
  4:    @author Frank M. Carrano
  5:    @author Timothy M. Henry
  6:    @version 5.0
  7: */
  8: public class Circle implements Comparable<Circle>, Measurable
  9: {
 10:    private double radius;

 12:    // Definitions of constructors and methods are here.
 13:    // . . .

 15:    public int compareTo(Circle other)
 16:    {
 17:       int result;
 18:       if (this.equals(other))
 19:          result = 0;
 20:       else if (radius < other.radius)
 21:          result = -1;
 22:       else 
 23:          result = 1;

 25:       return result;
 26:    } // compareTo
 27: } // end Circle