废话不多说直接上代码
运算:
public class Operation { public static double getResult(double a,double b,String operate){ double result = 0; switch (operate) { case "+": result = a+b; break; case "-": result = a-b; break; case "*": result = a*b; break; case "http://www.likecs.com/": result = a/b; break; default: break; } return result; } }