Skip to content

Instantly share code, notes, and snippets.

@DearRude
Last active November 26, 2021 11:53
Show Gist options
  • Save DearRude/e2d4862ffcc4f3eb2593cc9dc56ee439 to your computer and use it in GitHub Desktop.
Save DearRude/e2d4862ffcc4f3eb2593cc9dc56ee439 to your computer and use it in GitHub Desktop.
Iranian banks fee calculator
#!julia
shetab_fee(amount) = begin
500 <= amount <= 15e6 || (return Inf)
240(ceil(1e-6amount) - 1) + 600
end
satna_fee(amount) = begin
amount >= 15e6 || (return Inf)
fee = amount * 2e-4
fee > 25e3 ? 25e3 : fee
end
paya_fee(amount) = begin
1e3 <= amount <= 100e6 || (return Inf)
fee = amount * 1e-4
fee > 2.5e3 ? 2.5e3 :
fee < 200 ? 200 : fee
end
amo = parse(Int, ARGS[1]) * 1e3
printstyled("Shetab:\t$(shetab_fee(amo))\n", color=:cyan)
printstyled("Paya:\t$(paya_fee(amo))\n", color=:magenta)
printstyled("Satna:\t$(satna_fee(amo))\n", color=:yellow)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment