一个计算器,部分代码如下 ,就是比如:1+3=4....等等内容
现在要把它改成面向对象,应该怎么改的。
要求可维护性,比如: 我本来是判断1到5的,现在我想加入6到7的,应该怎么修改的最好能减少if语句,if(e.getActionCommand()=="1"){
   if(b!=5){
   s=s+"1";
   text.setText(s);
   }
  }
  if(e.getActionCommand()=="2"){
   if(b!=5){
   s=s+"2";
   text.setText(s);
   }
  }
  if(e.getActionCommand()=="3"){
   if(b!=5){
   s=s+"3";
   text.setText(s);
   }
  }
  if(e.getActionCommand()=="4"){
   if(b!=5){
   s=s+"4";
   text.setText(s);
   }
  }
  if(e.getActionCommand()=="5"){
   if(b!=5){
   s=s+"5";
   text.setText(s);
   }
  }