我是否正确地使用了UML图?

时间:2016-02-10 02:10:17

标签: java uml

问题:我是否正确制作了这个UML图?

UML图表:

  • -radius:double
  • + PI:double

  • + setRadius(rad:double):void

  • + getRadius(rad:double):void
  • + getArea():double
  • + getDiameter():double
  • + getCircumference():double

代码:

 public class Circle
{

  //Declaration
  private double radius;
  public static final double PI = 3.14159; 


  public Circle()
 {
  radius = 0.0;
 }
    public Circle(double rad)
   {
       radius = rad;
     }

   /**
     The setRadius method stores a value in the
     radius field.
      @param rad The value to store in radius.
   */

  public void setRadius(double rad)
   {
      radius = rad;
  }
    /**
     The getRadius method returns a Radius
     for the Circle.
     @return The entered radius in the radius field.
   */
    public double getRadius(double rad)
    {
  return radius;
   }
    /**
     The getArea method returns an Area
    for the Circle.
     @return The Area for the Circle.
   */
   public double getArea()
   {
     return PI * (radius * radius);
   }
     /**
     The getDiameter method returns a diameter
     for the Circle.
     @return The diameter for the Circle.
   */

0 个答案:

没有答案