Java Reference
In-Depth Information
236
Spaghetti Code
In fact, why even bother with the
do
loop? Here is a faithful interpretation of the
flowchart:
years = 1;
goto a; //
Not an actual
Java
statement
b:
years++;
a:
double interest = balance * rate / 100;
balance = balance + interest;
if (balance < targetBalance) goto b;