text: static public double ipmt(double r, int per, int nper, double pv, double fv, int type) {double ipmt = fv(r, per - 1, pmt(r, nper, pv, fv, type), pv, type) * r;if (type==1) ipmt /= (1 + r);return ipmt;}