goldringedstaff.java

来自「《JAVA与模式》附书中源代码」· Java 代码 · 共 52 行

JAVA
52
字号
package com.javapatterns.prototype.monkeyking;

import java.util.Date;

public class GoldRingedStaff implements Cloneable
{
    public GoldRingedStaff()
    {
        //write your code here
    }

    public void grow()
    {
        this.diameter *= 2.0;
        this.height *= 2;
    }

    public void shrink()
    {
        this.diameter /= 2;
        this.height /= 2;
    }

    public void move()
    {
        //write your code for moving the staff
    }

    public float getHeight()
    {
        return height;
    }

    public void setHeight(float height)
    {
        this.height = height;
    }

    public float getDiameter()
    {
        return diameter;
    }

    public void setDiameter(float diameter)
    {
        this.diameter = diameter;
    }

    private float height = 100.0F;
    private float diameter = 10.0F;
}

⌨️ 快捷键说明

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