技术开发 频道

利用UML序列图设计Java应用程序详解

    /*

    * Surface.java

    *

    
*/

    
class Surface {

    
private String name; // for identification purposes

    
private double length;

    
private double width;

    
public Surface(String initName, double initLength, double initWidth) {

    name
= initName;

    length
= initLength;

    width
= initWidth;

    }

    
public String getName() {

    
return name;

    }

    
public double getLength() {

    
return length;

    }

    
public double getWidth() {

    
return width;

    }

    
public double getArea() {

    
return width * length;

    }

    
public double getCircumference() {

    
return 2 * (length + width);

    }

    }

0
相关文章