public class Integration {
    public static double rect(MathFunction func, double a, double b, int n) {
        double h= (b-a)/n;
        double answer=0.0;
        for (int i=0; i < n; i++)
            answer += func.f(a+i*h);
        return h*answer;
    }
}
