⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 geometricshape.java

📁 此程序可实现:在可视化界面中随即生成一些图形(长方形、椭圆、圆、正方形);程序会自动告诉你所生成的图形的形状并计算这些图形的面积;最后程序会自动统计各个图形的分布。
💻 JAVA
字号:
import java.util.ArrayList;

/**
 * A superclass to define Geometric Shape.
 * 
 * @author Ruixiao Wu.
 * @version 1.0 26/06/2006.
 */
public abstract class GeometricShape {

	/**
	 * An abstract class to define the geometric shapes.
	 */

	

	/**
	 * An method to creat random parameter of geometric shapes.
	 * 
	 * @param numOfRandom,maxRange.
	 */
	public ArrayList<Integer> randomNum(int numOfRandom, int maxRange) {
		ArrayList<Integer> numList = new ArrayList<Integer>();
		int j;		
		for (int i = 0; i < numOfRandom; ++i) {
			j = (int) (Math.random() * maxRange + 1);
			numList.add(j);
		}
		return numList;
	}

	/**
	 * An abstract method to caculate the shapes' area.
	 
	 */
	abstract void calculateArea();

	/**
	 * An abstract method to caculate the shapes' perimeter.
	 
	 */
	abstract void calculatePerimeter();

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -