/**
 * Computes the value of a zero coupon bond.
 */
public class ZeroCoupon
{
    private double t;
    private double f;
    private double i;
    private double r;
   
    public ZeroCoupon( double face_value,
                       double interest_at_maturity,
                       double years_to_maturity,
                       double rate_for_maturity )    
    {
        t = years_to_maturity;
        f = face_value;
        i = interest_at_maturity;
        r = rate_for_maturity;
    }
    
    public double value() {
        return f*(1+i)*Math.exp(-r*t);
    }
}
