Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. def pop_bottle_recycler(investment)
  2. # Calculates no. of bottles bought
  3. amount = bottles_bought(investment)
  4.  
  5. unless condition
  6. total_bottles = 0
  7. total_bottles = amount + amount/2 + amount/4
  8. remainder_caps =
  9. end
  10.  
  11. end
  12.  
  13. # Returns how many bottles the customer can get for his investment
  14. def bottles_bought(investment)
  15. investment.to_i/2
  16. end
  17.  
  18. # Returns how many free bottles the customer gets for recycling a certain number (num) of empty bottles
  19. def empty_bottles_reward(num)
  20. num/2
  21. end
  22.  
  23. # Returns how many free bottles the customer gets for recycling a certain number (num) of bottle caps
  24. def bottle_caps_reward(num)
  25. num/4
  26. end
  27.  
  28. # Return total reward a customer can get with a certain amount of bottles
  29. def total_reward(num)
  30.  
  31. end
  32.  
  33. puts pop_bottle_recycler(20)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement