You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pbgr648qj/Arithmometer.java

32 lines
709 B

package com.wpc;
/* --- coding = utf-8 ---
* @Time: 2020/8/6 18:34
* @Author: 1807310509
* @File: Arithmometer.java
* @Software: IntelliJ IDEA
*/
public class Arithmometer {
private static double result;
public Arithmometer() {
}
public static double calculator(Double num1,String sign,Double num2) {
switch (sign) {
case "+":
result = num1 + num2;
break;
case "-":
result = num1 - num2;
break;
case "*":
result = num1 * num2;
break;
case "/":
result = num1 / num2;
}
return result;
}
}