From 742c0b1d65720c8a2b3457dbf2560ece4e6c2777 Mon Sep 17 00:00:00 2001 From: tvojnar Date: Thu, 10 Aug 2017 09:16:15 -0700 Subject: [PATCH 1/2] Create random_menu.rb --- random_menu.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 random_menu.rb diff --git a/random_menu.rb b/random_menu.rb new file mode 100644 index 0000000..06e0364 --- /dev/null +++ b/random_menu.rb @@ -0,0 +1,17 @@ +adjectives = ["Amazing", "Incredible", "Wonderful", "Weird", "Questionable", "Terrible", "Not bad", "Could be worse", "Even better", "Alright"] + +cooking_styles = ["seared", "baked", "sauteed", "fried", "glazed", "whipped", "grilled", "foamed", "rotisserie", "simmering" ] + +food = ["clams", "ribs", "chicken", "carrots", "beets", "steak", "pork chops", "salmon", "green beans", "lamb shank"] + +random = Array.new + +counter = 1 +loop do + x = "#{counter}. #{adjectives.shuffle.first} #{cooking_styles.shuffle.first} #{food.shuffle.first}" + random << x + counter += 1 + break if counter > 10 +end + +puts random From fbacd5ed52f096e1c68edf82dfbabb8607bf504e Mon Sep 17 00:00:00 2001 From: tvojnar Date: Thu, 10 Aug 2017 09:17:08 -0700 Subject: [PATCH 2/2] Create enhanced_random_menu.rb --- enhanced_random_menu.rb | 87 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 enhanced_random_menu.rb diff --git a/enhanced_random_menu.rb b/enhanced_random_menu.rb new file mode 100644 index 0000000..a12d6e4 --- /dev/null +++ b/enhanced_random_menu.rb @@ -0,0 +1,87 @@ +# BELOW IS CODE THAT WILL ALLOW THE USER TO FILL THE ARRAYS (ADJECTIVES, COOKING_STYLES, FOOD) THEMSELVES + +adjectives = Array.new +cooking_styles = Array.new +food = Array.new + +num = 0 +counter = 0 +loop do +puts "Please enter how many menu items you would like to see > " + number = gets.chomp.to_i + until number.between?(1,10) + puts "Please enter a whole number between 1 and 10!" + number = gets.chomp.to_i + end + num = number + counter += 1 + break if counter >= 1 +end + +num.times do + puts "Please enter a adjectives to discribe food:" + adjectives << gets.chomp +end + +num.times do + puts "Please enter a cooking style:" + cooking_styles << gets.chomp +end + +num.times do + puts "Please enter a type of food:" + food << gets.chomp +end + + +a_rand = adjectives.sample(num) +c_rand = cooking_styles.sample(num) +f_rand = food.sample(num) + +num.times do |i| + puts "#{i + 1}. #{a_rand[i]} #{c_rand[i]} #{f_rand[i]}" + +end + + + +# BELOW IS CODE THAT DEFINES THE ARRAYS FOR THE USER + +# num = 0 +# counter = 0 +# loop do +# puts "Please enter how many menu items you would like to see > " +# number = gets.chomp.to_i +# until number.between?(1,10) +# puts "Please enter a whole number between 1 and 10!" +# number = gets.chomp.to_i +# end +# num = number +# counter += 1 +# break if counter >= 1 +# end +# +# adjectives = ["Amazing", "Incredible", "Wonderful", "Weird", "Questionable", "Terrible", "Not bad", "Could be worse", "Even better", "Alright"] +# +# cooking_styles = ["seared", "baked", "sauteed", "fried", "glazed", "whipped", "grilled", "foamed", "rotisserie", "simmering" ] +# +# food = ["clams", "ribs", "chicken", "carrots", "beets", "steak", "pork chops", "salmon", "green beans", "lamb shank"] +# +# +# a_rand = adjectives.shuffle +# c_rand = cooking_styles.shuffle +# f_rand = food.shuffle +# +# random = Array.new +# +# counter = 1 +# i = 0 +# loop do +# x = "#{counter}. #{a_rand[i]} #{c_rand[i]} #{f_rand[i]} " +# random << x +# i += 1 +# counter += 1 +# break if i > (num - 1) +# end +# +# puts random