public class spend {
    private float lastm;
    private float thism;
    
    public spend(){    
    }//无参构造方法
    
    public spend(int lastm,int thism){
        this.lastm=lastm;
        this.thism=thism;
    }//含参构造
    
    public void getl(){
        System.out.println("上月电表读数为"+lastm) ;
        System.out.println("上月电费为"+lastm*1.2) ;
    }
    public void gett(){
        System.out.println("本月电表读数为"+thism) ;
        System.out.println("上月电费为"+thism*1.2) ;
    }//s1所用
    
    
    public void setl(int lastm){
        this.lastm=lastm;
        System.out.println("上月电表读数为"+lastm) ;
        System.out.println("上月电费为"+lastm*1.2) ;
    }    
    public void sett(int thism){
        this.thism=thism;
        System.out.println("本月电表读数为"+thism) ;
        System.out.println("上月电费为"+thism*1.2) ;
    }
    
//创建对象一:上月电表读数为1000,本月电表读数为1200。
//    要求:调用无参构造方法创建对象;
//         调用setXXX()方法初始化对象;
//          假设每度电的价格为1.2元,计算并显示本月电费。
//创建对象二:上月电表读数1200,本月电表读数为1450。
//       要求:调用2个参数的构造方法创建并初始化对象;
//       调用setXXX()方法修改本月电表读数为1500(模拟读错了需修改);
//       假设每度电的价格为1.2元,计算并显示本月电费。   
    public static void main (String[] args){
        spend s1 = new spend(1000,1200);
        spend s2 = new spend();
        s1.getl();
        s1.gett();
        s2.setl(1200);
        s2.setl(1500);
    }    
}