Created
June 20, 2010 04:16
-
-
Save johnholdun/445552 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
# That apartment is nice but it's outside your "40 x rent" limit. | |
# How much more are you gonna have to pay? | |
# NOTE: I Am Not A Broker, I'm only *pretty* sure this is how it works, | |
# calculate at your own risk. | |
def security(rent, salary) | |
normal_security = rent * 2 | |
base_rent = salary / 40.0 | |
extra_security = (rent - base_rent) * 10 | |
months = [((normal_security + extra_security) / rent.to_f).ceil, 2].max | |
months * rent | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment