Last active
January 12, 2021 16:20
-
-
Save adenhaus/5079fb82b8b4af0e9d498df9ddda1d84 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
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