25 lines
418 B
Java
25 lines
418 B
Java
package exp6;
|
|
|
|
public class OperationFactory {
|
|
public static Operation createOperate(String operate) {
|
|
Operation oper = null;
|
|
switch(operate) {
|
|
case "+":
|
|
oper = new OperationAddtion();
|
|
break;
|
|
case "-":
|
|
oper = new OperationSubtraction();
|
|
break;
|
|
case "*":
|
|
oper = new OperationMultiplication();
|
|
break;
|
|
case "/":
|
|
oper = new OperationDivision();
|
|
break;
|
|
|
|
}
|
|
return oper;
|
|
|
|
}
|
|
}
|