How can I make the result for this loop an array of the differents results:
for (int i = 1; i <= years; i++) {
double newbalance = account.getBalance() * rate;
account.deposit(newbalance);
String test = String.valueOf(account.getBalance()) + "\n";
result.append(test);
}
For example:
If the user put years 10
, that give me 10 results.
I need:
- To put these 10 results in an array.
- If the user eraser that input, an then press a specific button (I already have the code), the data need to be deleted and calculate with the new values.
Thank you.