import java.util.*;
public class Investment
{
public static int years=0;
public static void main(String[] args)
{
Scanner kbd = new Scanner(System.in);
System.out.println("Please enter an integer representing the whole dollar value of your initial investment: $");
int startBal=kbd.nextInt();
System.out.println("Please enter the whole number percentage, excluding the percent sign, of the interest rate on the investment.");
int interestRate=kbd.nextInt()/100;
int endBal=startBal*2;
int currentBal=startBal;
while (endBal>=currentBal)
{
currentBal=currentBal*interestRate+currentBal;
years++;
}
System.out.println("It will take "+years+" years to double your investment.");
}
}
The output I'm seeing is:
Please enter an integer representing the whole dollar value of your initial investment: $
10000
Please enter the whole number percentage, excluding the percent sign, of the interest rate on the investment.
5
The "10000" and "5" are my input. The program should be printing my final statement with the answer "15," but instead doesn't do anything, and doesn't terminate.