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

📄 rectangle.java

📁 国外的数据结构与算法分析用书
💻 JAVA
字号:
/**	A rectangle with a width and height, and also x and y coordinates (inherited from Shape). */
public class Rectangle extends Shape
{
	/**	Width and height of the rectangle. */
	protected int width, height;

	/**	Create a Rectangle with dimensions newWidth and newHeight, and positioned at (0, 0). 
		Analysis: Time = O(1) */
	public Rectangle(int newWidth, int newHeight)
	{
		height = newHeight;
		width = newWidth;
		x = 0;
		y = 0;
	}

	/**	Set the width and height to newWidth and newHeight. 
		Analysis: Time = O(1) */
	public void setDimensions(int newWidth, int newHeight)
	{
		height = newHeight;
		width = newWidth;
	}
  
	/**	String representation of the rectangle.
		Analysis: Time = O(1) */
	public String toString()   
	{
		return "\n" + indent + "Rectangle with width " + width + " and height " 
				+ height + "\n" + super.toString();
	}
} 

⌨️ 快捷键说明

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