circle.java

来自「国外的数据结构与算法分析用书」· Java 代码 · 共 33 行

JAVA
33
字号
import dslib.base.PairUos;

/**	A circle with a radius, and also x and y coordinates (inherited from Shape). */
public class Circle extends Shape
{
	/**	Radius of the circle */
	protected int radius;

	/**	Create a Circle with raduis newRaduis, and positioned at (0,0)
		Analysis: Time = O(1) */
	public Circle(int newRadius)
	{
		radius = newRadius;
		x = 0;
		y = 0;
	}

	/**	Set the radius to newRadius 
		Analysis: Time = O(1) */
	public void setRadius(int newRadius)
	{
		radius = newRadius;
	}

	/**	String representation of the circle 
		Analysis: Time = O(1) */
	public String toString()
	{
		return "\n" + indent + "Circle with radius " + radius 
				+ "\n" + super.toString();
	}
} 

⌨️ 快捷键说明

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