circle.java

来自「第四次作业 1、 创建一个Animal(动物)类」· Java 代码 · 共 45 行

JAVA
45
字号

public class Circle extends GraphicObject {
	/**
	 * specific attributes Circle has
	 * center and radius
	 */
	private Point center;
	private double radius;
	
	/**
	 * constructor that inherits from base class GraphicObject
	 * and initial the attributes added
	 */
	Circle(){
		super();
		center = new Point(0,0);
		radius = 1;
	}
	
	Circle(String lineColor,String fillColor,Point center,double radius){
		super(lineColor,fillColor);
		this.center = center;
		this.radius = radius;
	}
	
	

	@Override
	public void draw() {
		// TODO Auto-generated method stub
		System.out.println("Draw the center of the Circle is x = " + center.getX()+"y = "+center.getY()
				+"color of the line is "+super.getColorOfLine()+"fillcolor is "+super.getFillcolor());

	}

	@Override
	public void rotate() {
		// TODO Auto-generated method stub
		System.out.println("rotate this circle");
		draw();

	}

}

⌨️ 快捷键说明

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