Guest User

Untitled

a guest
Apr 22nd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. ## Chapter 7 ##
  2.  
  3. ### 99 Bottles of Beer on the Wall
  4. bottles_number = 99
  5. while bottles_number > 0
  6. puts bottles_number.to_s + ' Bottles of Beer on the Wall'
  7. bottles_number = bottles_number - 1
  8. end
  9.  
  10. ### Deaf grandma
  11.  
  12. message_to_grandma = gets.chomp
  13. while message_to_grandma != 'BYE'
  14. if message_to_grandma == message_to_grandma.upcase
  15. puts 'NO, NOT SINCE '+ (rand(20)+ 1930).to_s + '!'
  16. else
  17. puts 'HUH?! SPEAK UP, SONNY!'
  18. end
  19. message_to_grandma = gets.chomp
  20. end
  21.  
  22. ### Deaf grandma extended
  23. saying_bye = 0
  24. while saying_bye <3
  25. message_to_grandma = gets.chomp
  26. if message_to_grandma == message_to_grandma.upcase
  27. if message_to_grandma == 'BYE'
  28. saying_bye = saying_bye + 1
  29. puts '...'
  30. else
  31. puts 'NO, NOT SINCE '+ (rand(20)+ 1930).to_s + '!'
  32. end
  33. else
  34. puts 'HUH?! SPEAK UP, SONNY!'
  35. end
  36. end
  37.  
  38. ### Leap years
Add Comment
Please, Sign In to add comment