forked from Ada-C8/Random-Menu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrandom_menu.rb
More file actions
51 lines (46 loc) · 1.7 KB
/
random_menu.rb
File metadata and controls
51 lines (46 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Last edited 8/9/17
# Create a program that generates random menu
# Includes optional enhancement
# Array to store randomized menu output
random_menu_generator = []
counter = 0
# Create three arrays
# adjectives = ["slow", "spicy", "jerked", "creamy", "crispy", "sweet", "juicy", "seasoned", "savory", "flavorful"]
# cooking_styles = ["baked", "steamed", "fried", "roasted", "glazed", "grilled", "caramelized", "braised", "barbecued", "smoked"]
# foods = ["banana", "orange", "cantalope", "strawberry", "blueberry", "plums", "cucumber", "cherries", "apples", "pears"]
# welcome message
# assign variable to # of menus user will like to see
puts "Welcome! How many menus would you like?"
num_menu = gets.chomp.to_i
while num_menu > adjectives.length
puts "Invalid entry, please try again"
num_menu = gets.chomp.to_i
end
## randomly select an item from each array
## and ensure it is not duplicated
# num_menu.times do
# adjective = adjectives.sample
# adjectives.delete(adjective)
# cooking_style = cooking_styles.sample
# cooking_styles.delete(cooking_style)
# food = foods.sample
# foods.delete(food)
# user can customize menu
num_menu.times do
puts "Enter adjective"
adjective = gets.chomp
# adjectives.sample
# adjectives.delete(adjective)
puts "Enter cooking_style"
cooking_style = gets.chomp
# cooking_style = cooking_styles.sample
# cooking_styles.delete(cooking_style)
puts "Enter food"
food = gets.chomp
# food = foods.sample
# foods.delete(food)
counter += 1
random_menu_generator.push(" #{counter}. #{adjective} #{cooking_style} #{food}")
end
# output customized random menu generator
puts random_menu_generator