package bbb;
public class ccc {
private int month1,month2;
public ccc(){
}
public void setmonth1(int month1) {
this.month1=month1;
}
public void setmonth2(int month2) {
this.month2=month2;
}
public int getmonth1(){
return month1;
}
public int getmonth2(){
return month2;
}
public void lmonth(){
System.out.println("上月电表读数"+this.month1+"今年电费:"+month1*12*0.5);
}
public void tmonth(){
System.out.println("本月电表读数"+this.month2+"今年电费:"+month2*12*0.5);
}
}
package bbb;
public class Testccc {
public static void main(String[]args){
// System.out.println("上月电表读数为:");
ccc c1=new ccc();
c1.setmonth1(1000);
// System.out.println("本月电表读数为:");
ccc c2=new ccc();
c2.setmonth2(1200);
c1.lmonth();
c2.tmonth();
}
}