第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

答答租車系統(tǒng)

標(biāo)簽:
C

//新手初次动手,有不对的地方还请各位前辈指正,谢谢大家!
//这个系统我一共用了5个文件,具体其中都有注释,这是第一个

//创建抽象类,定义车辆共有属性和方法
public abstract class Car {
    /**
     * 车辆共有属性
     * @param    id 序号
     * @author  David
     */
    public int id;
    /**
     * 车辆共有属性
     * @param   name 名称
     * @author  David
     */
    public String name;
    /**
     * 车辆共有属性
     * @param   rent 租金
     * @author  David
     */
    public int rent;
    /**
     * 车辆共有方法
     * @param   attributes 信息
     * @author  David
     */
    public abstract void information();
}

第二个

//皮卡车子类,继承父类车的属性和方法,并有自己的属性载人量和载货量
public class Pickup extends Car {
    /**
     * 客车和皮卡车的特殊属性
     * @param    manned 载人量
     * @author  David
     */
    public int manned;
    /**
     * 货车和皮卡车的特殊属性
     * @param    loading 载货量
     * @author  David
     */
    public int loading;
    /**
     * 有参构造方法,给皮卡车属性赋值
     * @param    Pickup 皮卡车
     * @author  David
     */
    public Pickup(int id, String name, int rent, int manned, int loading){
        this.id = id;
        this.name = name;
        this.rent = rent;
        this.manned = manned;
        this.loading = loading;
    }
    @Override
    public void information() {
        // 输出皮卡车信息
        System.out.println(id + ".\t" + name + "\t " + rent + "元/天              " + "载人:" + manned + "人," + "载货:" + loading + "吨");
    }
}

第三个

//货车子类,继承父类车的属性和方法,并有自己的属性载货量
public class Truck extends Car {
    /**
     * 货车和皮卡车的特殊属性
     * @param    loading 载货量
     * @author  David
     */
    public int loading;
    /**
     * 有参构造方法,给货车属性赋值
     * @param    Turck 货车
     * @author  David
     */
    public Truck(int id, String name, int rent, int loading){
        this.id = id;
        this.name = name;
        this.rent = rent;
        this.loading = loading;
    }

    @Override
    public void information() {
        // 输出货车信息
        System.out.println(id + ".\t" + name + "\t " + rent + "元/天              " + "载货:" + loading + "吨");
    }
}

第四个

//客车子类,继承父类车的属性和方法,并有自己的属性载人量
public class Bus extends Car {
    /**
     * 客车和皮卡车的特殊属性
     * @param    manned 载人量
     * @author  David
     */
    public int manned;

    /**
     * 有参构造方法,给客车属性赋值
     * @param    Bus 客车
     * @author  David
     */
    public Bus(int id,String name, int rent,int manned){
        this.id = id;
        this.name = name;
        this.rent = rent;
        this.manned = manned;
    }
    @Override
    public void information() {
        // 输出客车信息
        System.out.println(id + ".\t" + name + "\t " + rent + "元/天              " + "载人:" + manned + "人");
    }
}
點(diǎn)擊查看更多內(nèi)容
26人點(diǎn)贊

若覺(jué)得本文不錯(cuò),就分享一下吧!

評(píng)論

作者其他優(yōu)質(zhì)文章

正在加載中
JAVA開(kāi)發(fā)工程師
手記
粉絲
87
獲贊與收藏
634

關(guān)注作者,訂閱最新文章

閱讀免費(fèi)教程

感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說(shuō)多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開(kāi)微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊(cè)有機(jī)會(huì)得

100積分直接送

付費(fèi)專欄免費(fèi)學(xué)

大額優(yōu)惠券免費(fèi)領(lǐng)

立即參與 放棄機(jī)會(huì)
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

舉報(bào)

0/150
提交
取消