1月20日作业-第三题

package com.lianxi;

public class zuofan {
    
    public zuofan()
    {
        System.out.println("做饭");
    }
    
    private String qiecai;
    
    private int jiashui;
    
    

    public String getQiecai() 
    {
        return qiecai;
    }

    public void setQiecai(String qiecai)
    {
        this.qiecai = qiecai;
    }

    public int getJiashui() 
    {
        return jiashui;
    }

    public void setJiashui(int jiashui)
    {
        this.jiashui = jiashui;
    }
    
    
    
    
    
        
    

}
package com.lianxi;

public class xihongshi extends zuofan
{

    public xihongshi()
    {
        System.out.println("西红柿炒蛋");
    }
    
    private String xicai;
    
    private int najidan;

    public String getXicai() {
        return xicai;
    }

    public void setXicai(String xicai) {
        this.xicai = xicai;
    }

    public int getNajidan() {
        return najidan;
    }

    public void setNajidan(int najidan) {
        this.najidan = najidan;
    }
    
    
    

    
}
    xihongshi xhs = new xihongshi();
        
        
        xhs.setJiashui(50);
        
        xhs.setNajidan(5);
        
        xhs.setXicai("洗西红柿");
        
        xhs.setQiecai("切西红柿");
        
        System.out.println("加入" +xhs.getJiashui()+ "毫升水"+",取"+ xhs.getNajidan()+"个鸡蛋" + ","+xhs.getXicai() + ","+xhs.getQiecai() );
        
        //做饭
        //西红柿炒蛋
        //加入50毫升水,取5个鸡蛋,洗西红柿,切西红柿

 

posted on 2016-01-21 00:08  一方通行o  阅读(148)  评论(0编辑  收藏  举报

导航