package bbb;
public class ccc {
private int month,lastmonth;
public ccc(){
}
/*public ccc(int month,int lastmonth){
this.month=month;
this.lastmonth=lastmonth;
}
*/
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getLastmonth() {
return lastmonth;
}
public void setLastmonth(int lastmonth) {
this.lastmonth = lastmonth;
}
public void month(){
System.out.println("今年电表读数为:"+this.month+"\n"+"今年电费为:"+month*1.2);
}
public void lastmonth(){
System.out.println("去年电表读数为:"+this.lastmonth+"\n"+"去年电费为:"+lastmonth*1.2);
}
}
package bbb;
import java.util.Scanner;
public class Testccc {
public static void main(String[] args) {
ccc aa=new ccc();
/*@SuppressWarnings("resource")
Scanner sc=new Scanner(System.in);
aa.setMonth(sc.nextInt());
aa.setLastmonth(sc.nextInt());
aa.month();
aa.lastmonth();*/
aa.setMonth(1000);
aa.setLastmonth(1200);
aa.month();
aa.lastmonth();
}
}