Skip to content

Instantly share code, notes, and snippets.

@adenhaus
Last active January 12, 2021 16:20
Show Gist options
  • Save adenhaus/5079fb82b8b4af0e9d498df9ddda1d84 to your computer and use it in GitHub Desktop.
Save adenhaus/5079fb82b8b4af0e9d498df9ddda1d84 to your computer and use it in GitHub Desktop.
public class WithoutAbstractions {
int upClass = 500000;
int midClass = 100000;
int lowClass = 50000;
int taxMax = 0.45;
int taxMid = 0.30;
int taxMin = 0.15;
public static int balanceAfterTax(int moneyIn, int moneyOut) {
int balance = moneyIn - moneyOut;
if (balance > upClass) {
return balance - balance * taxMax;
} else if (balance > midClass) {
return balance - balance * taxMid;
} else if (balance > lowClass) {
return balance - balance * taxMin;
} else {
return balance;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment