一个简单的面向对象编程实例(计算器)

废话不多说直接上代码

运算:

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;   } }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzjxxd.html