Created
July 6, 2016 17:25
-
-
Save kobigurk/fdbb8078cd4d76d7dbeac75014214fba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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