Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- require 'date'
- puts "Let's start tell a story of you. First, I need to grab some details."
- puts " "
- print "What is your first name? "
- first_name = gets.chomp
- puts " "
- print "How about your last name? "
- last_name = gets.chomp
- puts " "
- print "What year were you born?(i.e. 1980) "
- year_born = gets.chomp
- current_year = Date.today.strftime("%Y").to_i
- age = current_year - year_born.to_i
- puts " "
- print "Have you had your birthday yet this year?(y/n) "
- birthday_question = gets.downcase[0].to_s
- puts " "
- print "What city do you call home? "
- home_city = gets.chomp.to_s.capitalize
- puts " "
- print "Do you identify as a woman or man? "
- gender_id = gets.downcase[0]
- if birthday_question == "n"
- new_age = (age.to_i - 1)
- age.to_s
- elsif birthday_question == "y"
- new_age = age
- end
- if gender_id == "w"
- greeting = "Ms."
- elsif gender_id == "m"
- greeting = "Mr."
- end
- 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