package _01_static.demo3;

public class MyMathUtil {
    private MyMathUtil() {
    }

    // 加减乘除
    public static int calc(int a, int b, String operator) {
        if ("+".equals(operator)) {
            return a + b;
        } else if ("-".equals(operator)) {
            return a - b;
        } else if ("*".equals(operator)) {
            return a * b;
        } else if ("/".equals(operator)) {
            return a / b;
        }
        return 0;
    }
}
