Skip to content
Open
Show file tree
Hide file tree
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
14 changes: 14 additions & 0 deletions random_menu_basic.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

adjectives = ["hot", "chilled", "sweet", "creamy", "salted", "spicy", "herb-crusted", "tender", "aged", "tangy"]
cooking_method = ["baked", "roasted", "pan-fried", "steamed", "boiled", "toasted", "smoked", "chopped", "grilled", "braised"]
food = ["free range chicken", "grass fed beef filet", "clams", "mussels", "salmon", "beets", "brussel sprouts", "root vegetable medley", "kale", "potatos"]

n = 0

10.times do
n += 1
x = rand(0...10)
y = rand(0...10)
z = rand(0...10)
puts "#{n}. #{adjectives[x].capitalize} #{cooking_method[y].capitalize} #{food[z].capitalize}"
end
33 changes: 33 additions & 0 deletions random_menu_with_optionals.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
puts "Welcome to the Random Menu Creator!"
puts "How many menu items would you like to generate?"
num_items = gets.chomp.to_i

until num_items > 0
puts "That is not a valid number. Please enter the number of menu items."
num_items = gets.chomp.to_i
end

puts "Thank you! Let's get started!"

food = Array.new
adjectives = ["hot", "chilled", "sweet", "creamy", "salted", "spicy", "herb-crusted", "tender", "aged", "tangy"]
cooking_method = ["baked", "roasted", "pan-fried", "steamed", "boiled", "toasted", "smoked", "chopped", "grilled", "braised"]

until food.length == num_items
puts "Please enter one food item you have to offer (ex: chicken, root vegetables, squash...)."
food << gets.chomp.upcase
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Watch your indentation here - the inside of a loop should be two spaces in.

end

n = 0
i = 0

adjectives.shuffle!
cooking_method.shuffle!
food.shuffle!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good use of shuffle.


puts "Here is your random Menu, Bon Appetit! :)"
num_items.times do
n += 1
puts "#{n}. #{adjectives[i].upcase} #{cooking_method[i].upcase} #{food[i]}"
i += 1
end