手机充电(练习)

public class Shouji {
    //属性(成员变量) 
    
    String YanSe;//手机的颜色
    

    String PinPai;    //手机的品牌
    
    double ShouJiDianLiang;//手机电量
    
    double DangQianDianLiang;//当前电量
    
    //方法(成员函数/函数)
    public void chongDian(double dianliang){
        DangQianDianLiang +=dianliang;
                System.out.println("今天给"+YanSe+"的"+PinPai+"手机充了"+dianliang+"的电量");
    }
    
}


public class diaoyong {

    public static void main(String[] args) {
        //构建一个ShouJid的实例,对象
        Shouji moto=new Shouji();
        moto.PinPai="摩托罗拉";
        moto.YanSe="白色";
        moto.chongDian(0.2);
        
    }

}
public class Shouji {
    //属性(成员变量) 
    
    String YanSe;//手机的颜色
    

    String PinPai;    //手机的品牌
    
    double ShouJiDianLiang;//手机电量
    
    double DangQianDianLiang;//当前电量
    
    //方法(成员函数/函数)
    public void chongDian(double dianliang){
        DangQianDianLiang +=dianliang;
                System.out.println("今天给"+YanSe+"的"+PinPai+"手机充了"+dianliang+"的电量");
    }
    
}


public class diaoyong {

    public static void main(String[] args) {
        //构建一个ShouJid的实例,对象
        Shouji moto=new Shouji();
        moto.PinPai="摩托罗拉";
        moto.YanSe="白色";
        moto.chongDian(0.2);
        
    }

}
public class Shouji {
    //属性(成员变量) 
    
    String YanSe;//手机的颜色
    

    String PinPai;    //手机的品牌
    
    double ShouJiDianLiang;//手机电量
    
    double DangQianDianLiang;//当前电量
    
    //方法(成员函数/函数)
    public void chongDian(double dianliang){
        DangQianDianLiang +=dianliang;
                System.out.println("今天给"+YanSe+"的"+PinPai+"手机充了"+dianliang+"的电量");
    }
    
}


public class diaoyong {

    public static void main(String[] args) {
        //构建一个ShouJid的实例,对象
        Shouji moto=new Shouji();
        moto.PinPai="摩托罗拉";
        moto.YanSe="白色";
        moto.chongDian(0.2);
        
    }

}

 

posted @ 2015-12-08 08:52  怪咖咖  阅读(219)  评论(0编辑  收藏  举报