you must will try add a String variable… like…
String reglerAnnee;
...
// add a space if year(anne) is less than 10
// using a ternary operator, like an "if" but less code
reglerAnnee = annee < 10 ? " " : "";
..
// and add to the println ...
System.out.println(" "+reglerAnnee + annee + " " + (int) capitalDeDepart
+ "$ " + (int) interet + "$ "
+ (int) nouveauCapital + "$");
...
The result will be like:
1 10000$ 1000$ 11000$
2 11000$ 1100$ 12100$
...
9 21435$ 2143$ 23579$
10 23579$ 2357$ 25937$
CLICK HERE to find out more related problems solutions.