Created
July 9, 2014 18:57
-
-
Save iheartkode/b845589f050ee239a72b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allergens = { | |
"eggs" => 1, | |
"peanuts" => 2 , | |
"shellfish" => 4, | |
"strawberries" => 8, | |
"tomatoes" => 16, | |
"chocolate" => 32, | |
"pollen" => 64, | |
"cats" => 128, | |
} | |
def add(alergen1, allergen2) | |
total = alergen1.to_i + allergen2.to_i | |
puts "Your Allergy score is: #{total}" | |
end | |
puts ":::::::Here is the list of allergens:::::::" | |
allergens.each do |allergy| | |
puts allergy | |
end | |
puts "Enter two allergen numbers" | |
puts "First number" | |
num1 = gets.chomp | |
puts "Second number" | |
num2 = gets.chomp | |
add(num1,num2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment