Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def pop_bottle_recycler(investment)
- # Calculates no. of bottles bought
- amount = bottles_bought(investment)
- unless condition
- total_bottles = 0
- total_bottles = amount + amount/2 + amount/4
- remainder_caps =
- end
- end
- # Returns how many bottles the customer can get for his investment
- def bottles_bought(investment)
- investment.to_i/2
- end
- # Returns how many free bottles the customer gets for recycling a certain number (num) of empty bottles
- def empty_bottles_reward(num)
- num/2
- end
- # Returns how many free bottles the customer gets for recycling a certain number (num) of bottle caps
- def bottle_caps_reward(num)
- num/4
- end
- # Return total reward a customer can get with a certain amount of bottles
- def total_reward(num)
- end
- puts pop_bottle_recycler(20)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement