I am having a problem with a program I wrote.. For the life of me I can't figure out what's wrong with the program.. the program should calculate a random value and then outputs an intrest rate and present value.. The problem is that I am getting zeros instead of real numbers.
import java.lang.*;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.*;
public class CompoundFormulaLab {
/**
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
double presentValue= 0;
double futureValue = 1000000;
//int x = 100 + (int)(Math.random()*200);
Random randomizer = new Random ();
double calcInterest =(double) (randomizer.nextInt(10));
double yearsInFuture = 20;
//double dollarAmount=0;
double interestRate=0;
double annualIntrestRate=0;
annualIntrestRate = calcInterest / 100;
presentValue = futureValue/(Math.pow(1+(annualIntrestRate), futureValue));
//DecimalFormat money = new DecimalFormat("$0.00");
DecimalFormat dollarAmount = new DecimalFormat("$#.##");
interestRate = presentValue * annualIntrestRate;
NumberFormat interestRatePrint = NumberFormat.getNumberInstance();
interestRatePrint.setMinimumFractionDigits(3);
//System.out.print(dollarAmount.format(presentValue));
System.out.print("The amount of dollars is " +dollarAmount.format(presentValue) +" and the interest is " +interestRatePrint.format(interestRate) +"%");
}
}
This is the whole program.. I appreciate your help