tv.java

来自「关于java面向对象系统分析方面的课件」· Java 代码 · 共 67 行

JAVA
67
字号
/*
 * s2javaoo.lg.ch02.TV.java
 * 2007-7-23
 * 电视类
 */
package s2javaoo.lg.ch02;

public class TV extends Wiring {

    private String type; // 电视种类

    private int volume; // 最大音量

    /**
     * 构造方法
     */
    public TV() {
        this.setPower(100);
        this.setCurrent(50);
        this.setType("长虹50寸液晶电视");
        this.setVolume(200);
    }

    /**
     * 电视的工作方法
     */
    public void work() {
        System.out.println("电视在工作");
        System.out.println("这台电视的功率是 " + this.getPower());
        System.out.println("这台电视的额定电压是 " + this.getPressure());
        System.out.println("这台电视的额定电流是 " + this.getCurrent());
        System.out.println("这台电视的交直流类型是 " + this.getElectricity());
        System.out.println("这台电视的种类是 " + this.getType());
        System.out.println("这台电视的最大音量是 " + this.getVolume());
    }

    /**
     * @return type
     */
    public String getType() {
        return type;
    }

    /**
     * @param type
     *            要设置的 type
     */
    public void setType(String type) {
        this.type = type;
    }

    /**
     * @return volume
     */
    public int getVolume() {
        return volume;
    }

    /**
     * @param volume
     *            要设置的 volume
     */
    public void setVolume(int volume) {
        this.volume = volume;
    }
}

⌨️ 快捷键说明

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