package bbb;
import java.util.Scanner;
public class ccc {
Scanner in = new Scanner(System.in);
private double Lastmonth;
private double Thismonth;
public void print()
{ Double M;
System.out.println("请输入上个月与这个月的电费读表");
Lastmonth = in.nextDouble();
Thismonth= in.nextDouble();
M=(Thismonth-Lastmonth)*1.2;
System.out.println("电费为:"+M);
}
public double getLastMonth() {
return Lastmonth;
}
public void setLastMonth(double Lastmonth) {
this.Lastmonth = Lastmonth;
}
public double getThisMonth() {
return Thismonth;
}
public void ThisMonth(double Thismonth) {
Double M;
this.Thismonth =Thismonth;
M=(Thismonth)*1.2;
System.out.println("电费为:"+M);
}
}
package bbb;
import java.util.Scanner;
public class text {
public static void main(String args[]){
Scanner in = new Scanner(System.in);
Double Thismonth;
ccc c1=new ccc();
ccc c2=new ccc();
c1.print();
c2.print();
System.out.println("请重新输入本月电费:");
Thismonth=in.nextDouble();
c2.ThisMonth(Thismonth);
}
}