某系统提供一个简单计算器,具有简单的加法和减法功能,系统可以根据用户的选择实例化相应的操作类。现使用简单工厂模式设计该系统,类图如下: abstract class Operation{ protected int numberA; protected int numberB; //numberA,numberB的getter、setter方法略去 public int getResult(); } class AddOperation extends Operation{ public int getResult(){ return numberA+numberB; } } class SubOperation extends Operation{ public int getResult(){ return numberA-numberB; } } class Calculator{ public createOperation(char operator){ Operation op = null; { case '+': op = ; break; case '-': op = ; break; } ; } } class Test{ public static void main(String[] args){ int result; Operation op1 = Calculator.createOperation('+'); op1.setNumberA(20); op1.setNumberB(10); result = ; System.out.println(result); } }