001 package ps0.optional;
002
003 public class FinancialCalc {
004
005 public static void main(String[] args) {
006 double principal = 1000.00; // $1000 initial investment
007 double interestRate = 0.035; // 3.5% interest rate
008 int numOfYears = 7; // investment length is 7 years
009
010 double value = 0.0;
011 value = principal * Math.pow((1 + interestRate), numOfYears);
012
013 System.out.println("Investing $" + principal +
014 " at an interest rate of " + (interestRate*100) + "%" +
015 " for " + numOfYears + " years" +
016 " will have a final worth of $" + value);
017 }
018
019 }