import javax.swing.*;     

class Investment {
  public static void main(String[] args)
    {
        double endValue, initInvest, annPercentRate;
        int years;


        // get initInvest,annPercentRate and years using an InputDialogBox

           String initInvestStr, annPercentRateStr,yearsStr;
           initInvestStr = JOptionPane.showInputDialog(null,"Enter Initial Investment:");
           annPercentRateStr = JOptionPane.showInputDialog(null,"Enter Annual Percentage Rate:");
           yearsStr = JOptionPane.showInputDialog(null,"Enter Number of Years:");

        // Convert to numbers
         
           initInvest = Double.parseDouble(initInvestStr);
           annPercentRate = Double.parseDouble(annPercentRateStr);
           years = Integer.parseInt(yearsStr);

        // Compute endValue

           endValue = initInvest*(Math.pow(1+annPercentRate/100.0,years));

        // Display endValue using a MessageDialogBox
        
           JOptionPane.showMessageDialog(null,"Your initial investment of $" + initInvest + " at "  
                                         + annPercentRate + " %  interest " + "\n" +
                                         " will grow to " + " $" + endValue  + " after " + years + " years");             

           System.exit(0);
    }
}