import java.util.Scanner;
public class zeroCouponBond
{
public static void main(String[] args)
{
Scanner usrObj = new Scanner(System.in);
System.out.print("Face Value of Bond: ");
int faceValue = usrObj.nextInt();
System.out.print("Years To Maturity: ");
int yearsToMaturity = usrObj.nextInt();
System.out.print("Rate of Interest: ");
int returnOnInvestment = usrObj.nextInt();
double BP1 = (faceValue/(Math.pow((returnOnInvestment + 1), yearsToMaturity)));
System.out.println("Present Bond Value: "+BP1);
}
}
Input data Face Value - £1000 Years to Maturity - 20 Rate of Interest - 5
Given the formula: F / (1 + r)^t
why do i get 2.73511... I expect 376.89