第四次JAVA作业
package AAA;
class testPor1 {
private int a,b;
public int getA() {
return a;
}
public void setA(int a) {
this.a = a;
}
public int getB() {
return b;
}
public void setB(int b) {
this.b = b;
}
public void print(){
System.out.println("上个月电数为:"+a+"本月电数为:"+b+"本月电费为:"+1.2*b);
}
}
public class Dianbiao{
public static void main (String[]args){
testPor1 p1=new testPor1();
p1.setA(1000);
p1.getA();
p1.print();
testPor1 p2=new testPor1();
p2.setA(1000);
p2.getA();
p2.setB(1200);
p2.getB();
p2.print();
}
}