### Example: Modified Internal Rate of Return

A farmer uses a $4500 loan to buy 10 young cows and a bull. The interest rate on the loan is 8%. He expects to reinvest the profits received in any one year in the money market and receive 5.5%. The first year he does not expect to sell any calves, he just expects to feed them. Thereafter, he expects to be able to sell calves to offset the cost of feed. He expects them to be productive for 9 years, after which time he will liquidate the herd. The modified internal rate of return is computed after 9 years.
import com.imsl.finance.*;
import java.text.NumberFormat;
public class mirrEx1 {
public static void main(String args[]) {
double[] value = {-4500., -800., 800., 800., 600., 600.,
800., 800., 700., 3000.};
double financeRate = .08;
double reinvestRate = .055;
double mirr = Finance.mirr(value, financeRate, reinvestRate);
NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMaximumFractionDigits(2);
System.out.println("After 9 years, the modified internal rate of "
+ "return on the cows is " + nf.format(mirr));
}
}

#### Output

After 9 years, the modified internal rate of return on the cows is 6.66%

Link to Java source.