Skip to content

Instantly share code, notes, and snippets.

@bomatson
Created June 25, 2014 01:10
Show Gist options
  • Save bomatson/ad9aaa2b4457248187d8 to your computer and use it in GitHub Desktop.
Save bomatson/ad9aaa2b4457248187d8 to your computer and use it in GitHub Desktop.
puts
puts "Hi! Welcome to Keeley's Kwirky Kuisine! Please see our menu below:"
drinks = ["pina colada", "pbr", "fireball shot", "smirnoff ice", "champagne"]
apps = [ "nachos", "guacamole", "a bloomin onion", "bread sticks", "garlic knots" ]
entrees = [ "a hamburger", "chicken strips", "fried chicken"]
desserts = [ "chocolate cake", "apple pie", "banana split", "creme brulee"]
user_order = {}
# The first area of your app lists all the items available:
#drinks.each do |drink|
# puts "#{drink}"
#end
# Since it uses the same logic, why not wrap it in a function?
def list_items(course_array) #we pass the function our course array (drinks, apps, etc)
course_array.each do |item| #loop through each element of the array
#and output its contents
puts "#{item}"
end
end
puts
puts "Kocktails:"
# then call the function here!
list_items(drinks)
puts
puts "Appetizers:"
# and here!
list_items(apps)
puts
puts "Entrees:"
# and here!
list_items(entrees)
puts
puts "Desserts:"
list_items(desserts)
puts
puts "Can I get you anything to drink?"
drink_order = gets().chomp().downcase()
if drinks.include? drink_order
user_order["drink"] = drink_order
end
puts
puts "How about an appetizer?"
app_order = gets().chomp().downcase()
if apps.include? app_order
user_order["app"] = app_order
end
puts
puts "For your entree?"
entree_order = gets().chomp().downcase()
if entrees.include? entree_order
user_order["entree"] = entree_order
end
puts
puts "Would you like a dessert?"
dessert_order = gets().chomp().downcase()
if desserts.include? dessert_order
user_order["dessert"] = dessert_order
end
puts
puts "Would you like to add any notes to your order?"
notes_order = gets().chomp()
user_order["notes"] = notes_order
puts "I have your order as:"
puts user_order.values
puts
puts "Thank you for placing an order!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment