rectangle.java
来自「这是一种用JAVA开发的图形画法程序 没有错误 欢迎各位朋友改进并上传」· Java 代码 · 共 41 行
JAVA
41 行
/**
* Title: Rectangle.java
* Description: should be subclasses of GeometricShape and include the implementation of two methods
* named calculateArea and calculatePerimeter.
*
* Copyright: Copyright (c) 2006
* @author Q Jin
* @version 1.0
*/
public class Rectangle extends GeometricShape{
// this is a default Rectanfle method
public Rectangle(){
this(0,0);
}
// this is a Rectangle method with two parameters
public Rectangle( int x, int y ){
this.x = x;
this.y = y;
}
/**
* this is a calculateArea method
*
* @return x*y this is a area of shapes
*/
public int calculateArea(){
return x * y;
}
/**
* this is a calculatePerimeter method
*
* @return 2 * ( x + y ) this is perimeter of shapes
*/
public int calculatePerimeter(){
return 2 * ( x + y );
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?