Skip to content

Instantly share code, notes, and snippets.

@kobigurk
Created July 6, 2016 17:25
Show Gist options
  • Save kobigurk/fdbb8078cd4d76d7dbeac75014214fba to your computer and use it in GitHub Desktop.
Save kobigurk/fdbb8078cd4d76d7dbeac75014214fba to your computer and use it in GitHub Desktop.
class Bank {
int[] balances = {0, 100, 0};
void send(int from, int to, int amount) {
if (balances[from] >= amount) {
balances[from] -= amount;
balances[to] += amount;
}
}
void printBalances() {
for (int i = 0; i < balances.length; i++) {
System.Out.printLn(balances[i]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment