package com.imsl.test.example.finance; import com.imsl.finance.*; import java.text.NumberFormat; /** *
* Computes the net present value of a lottery prize.
* A lady wins a $10 million lottery. The money is to be paid out at the end of * each year in $500,000 payments for 20 years. The current treasury bill rate * of 6% is used as the discount rate. Here, the present value of her prize is * computed. * * * @see Code * @see Output */ public class FinancePvEx1 { public static void main(String args[]) { double rate = 0.06; double pmt = 500000.; double fv = 0.; int nper = 20; int when = Finance.AT_END_OF_PERIOD; double pv = Finance.pv(rate, nper, pmt, fv, when); System.out.println("The present value of the $10 million prize is " + NumberFormat.getCurrencyInstance().format(pv)); } }