咳咳,这。。无语。
class Calculator{
int i ;
int j;
double result;
Calculator(int i,int j,double result){
this.i=i;
this.j=j;
this.result = result;
}
public void jia(){
result = i+j;
System.out.println ("i+j="+result);
}
public void jian(){
result = i-j;
System.out.println ("i-j="+result);
}
public void cheng(){
result = i*j;
System.out.println ("i*j="+result);
}
public void chu(){
result = (double)i/j;
System.out.println ("i/j="+result);
}
}
public class test{
public static void main (String[] args) {
int i =5,j = 4;
double re =0;
Calculator Cc =new Calculator(i,j,re);
Cc.jia();
Cc.jian();
Cc.cheng();
Cc.chu();
}
}