📄 rectangle.java
字号:
/**
* 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -