Skip to content

Instantly share code, notes, and snippets.

@charmainetham
Last active April 27, 2016 02:01
Show Gist options
  • Save charmainetham/4d6b369d81d73f7f45ca70144361535c to your computer and use it in GitHub Desktop.
Save charmainetham/4d6b369d81d73f7f45ca70144361535c to your computer and use it in GitHub Desktop.
RENTER
# must be baller and either furnished or rent cheaper than 2100
def rent?(furnished, rent, baller)
if baller && furnished || rent < 2100
return true
else
return false
end
end
###
# Add your "test" ("driver") code below in order to "test drive" (run) your method above...
# The test code will call the method with different permutations of options and output the result each time.
# This way, you will be able to run the renter.rb file from the CLI and look at the output of your "tests" to validate if the method works.
# Without the test code, it will be hard for you to know if this method is working as it should or not.
###
def rent?(furnished, rent, baller)
baller && (furnished || rent < 2100)#will only return true if it satisfy this condition
end
# testing code
puts rent?(true, 100, true)
puts rent?(false, 200, true)
puts rent?(false, 1000, false)#this needs to return false but returns true i first example
puts rent?(true, 2999, false)
puts rent?(true, 4000, true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment