import java.util.Scanner;
import javax.swing.JOptionPane;

public class Ch6
{
Scanner in;
public Ch6()
{    in = new Scanner(System.in);
    int year = 1;
    System.out.print("Interest rate %: >");
    double rate = in.nextDouble();
    System.out.print("Initial amount: >");
    double balance = in.nextDouble();
    System.out.print("Financial goal: >");
    double goal = in.nextDouble();
    while(balance < goal)
    {    balance = balance + balance * rate / 100;
        String msg = "Year: " + year + " Balance: " + balance;
        System.out.println(msg);
        year++;
    }
}

public void runIt()
{     int sum = 0, i = 0;
    while (sum < 10) ;
    {     i++; sum = sum + i;
        System.out.println(i + " " + sum);
    }
}

public void dowhile()
{ do
{     JOptionPane.showMessageDialog(null, "Hello Metuchen");
}
while(1 < 0);
}

public void loop2()
{ int i;
String word = "Metuchen";
for (i = 0; i < word.length(); i++)
{     System.out.print(i + " ");
}
}

public void forloop()
{ int i, numberOfYears;
String s, msg;
msg = "Run for how many years: ";
s = JOptionPane.showInputDialog(msg);
numberOfYears = Integer.parseInt(s);
double balance = 1000; double rate = 0.25;
for (i = 0; i < numberOfYears; i++)
{    double interest = balance * rate;
    balance = balance + interest;
    String msg2 = "Year: " + i + " Balance: " + balance;
    System.out.println(msg2);
}
}

public void nestedLoop1()
{ int row, col;
for (row = 1; row < 11; row++)
{     for (col = 1; col < 11; col++)
      {     System.out.print(row * col + " ");
      }
System.out.println();
 }
}

public static void main(String[] args)
{ Ch6 c = new Ch6();
//c.runIt();
// c.dowhile();
//c.forloop();
//c.loop2();
c.nestedLoop1();
}
}