public class Interest { public static void main(String[] args) { // How many years does it take for the principal to double? final double rate = .06; // 6 percent final double factor = 1 + rate; final double start = 100; double amount = start; int year = 0; do { amount = amount * factor; // amount *= factor; year = year + 1; // ++year System.out.println(year + "\t" + amount); // tab character } while (amount < 2 * start); System.out.println(); System.out.println(Math.log(2.0) / Math.log(factor)); } }