Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2015
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2. require 'date'
  3.  
  4. puts "Let's start tell a story of you. First, I need to grab some details."
  5. puts " "
  6. print "What is your first name? "
  7. first_name = gets.chomp
  8. puts " "
  9. print "How about your last name? "
  10. last_name = gets.chomp
  11. puts " "
  12. print "What year were you born?(i.e. 1980) "
  13. year_born = gets.chomp
  14. current_year = Date.today.strftime("%Y").to_i
  15. age = current_year - year_born.to_i
  16. puts " "
  17. print "Have you had your birthday yet this year?(y/n) "
  18. birthday_question = gets.downcase[0].to_s
  19. puts " "
  20. print "What city do you call home? "
  21. home_city = gets.chomp.to_s.capitalize
  22. puts " "
  23. print "Do you identify as a woman or man? "
  24. gender_id = gets.downcase[0]
  25.  
  26. if birthday_question == "n"
  27. new_age = (age.to_i - 1)
  28. age.to_s
  29. elsif birthday_question == "y"
  30. new_age = age
  31. end
  32.  
  33. if gender_id == "w"
  34. greeting = "Ms."
  35. elsif gender_id == "m"
  36. greeting = "Mr."
  37. end
  38.  
  39. puts "Hello #{greeting} #{first_name} #{last_name}. It is nice to meet you! From the information I gathered it looks like you call #{home_city} your home and you are currently #{new_age} years old. Keep it up my fellow coder!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement