组装一台计算机

 

//实现显示CUP内存的功能
package zuoye03;

public interface CPU {
    
    public String pingPai();
    public String zhuPing();

}


//实现显示内存的功能
package zuoye03;

public interface Neicun {

    
    public String neiCunRongLiang();
}

//实现显示硬盘内存的功能
package zuoye03;

public interface Yingpa {

    public String yingparongLinag();
    
    
    
    
}
package zuoye03;

//计算机父类  实现类
public class Computer implements CPU,Neicun,Yingpa{

    @Override
    public String yingparongLinag() {
        // TODO Auto-generated method stub
        
        return "3000GB";
    }

    @Override
    public String neiCunRongLiang() {
        // TODO Auto-generated method stub
        return "4GB";
    }

    @Override
    public String pingPai() {
        // TODO Auto-generated method stub
        return "Intel";
    }

    @Override
    public String zhuPing() {
        // TODO Auto-generated method stub
        return "3.8GHz";
    }

    
    
    
}


//测试类
package zuoye03;

public class TestComputer {
    
    
    public static void main(String[] args) {
        
        
        Computer c = new Computer();
        System.out.println("计算机的信息如下:");
        //CUP品牌   主频
        String cpuPingPai = c.pingPai();
        String cpuZhuPing = c.zhuPing();
        System.out.println("CPU的品牌是:"+cpuPingPai+","+"主频是:"+cpuZhuPing);
        
        //硬盘容量
        String yingPanRongLian = c.yingparongLinag();
        System.out.println("硬盘容量是:"+yingPanRongLian);
        
        
        
        //内存容量
        String neiCun = c.neiCunRongLiang();
        System.out.println("内存容量是:"+ neiCun);
    }

}

 

posted @ 2019-07-19 21:43  AxeBurner  阅读(214)  评论(0编辑  收藏  举报