Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions random-menu.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Create three empty arrays
food_adjectives = []
food_styles = []
foods = []

# Prompt for number of menu items
puts "How many menu items do you want displayed?"
number = gets.to_i

# Using user input, collecting more user input and store into arrays
number.times do
puts "Give me a food adjective:"
food_adjective = gets.chomp
food_adjectives << food_adjective

puts "Give me a food style:"
food_style = gets.chomp
food_styles << food_style

puts "Give me a food:"
food = gets.chomp
foods << food
end

# Shuffle arrays
food_adjectives.shuffle!
food_styles.shuffle!
foods.shuffle!

# Display shuffled arrays
number.times do |i|
puts "#{i + 1}. " + food_adjectives[i] + " " + food_styles[i] + " " + foods[i]
end