parent
acf6347b76
commit
a76f75d5bc
@ -0,0 +1,31 @@
|
||||
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;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue