From 0f73f99b56b8f29ab410a0ba8143392f793b2606 Mon Sep 17 00:00:00 2001 From: CheerOnMars <36147056+CheerOnMars@users.noreply.github.com> Date: Tue, 6 Feb 2018 11:30:15 -0800 Subject: [PATCH 1/2] Add files via upload --- wk1_random_menu_generator.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 wk1_random_menu_generator.rb diff --git a/wk1_random_menu_generator.rb b/wk1_random_menu_generator.rb new file mode 100644 index 0000000..fdbc4aa --- /dev/null +++ b/wk1_random_menu_generator.rb @@ -0,0 +1,21 @@ +# Runs a random menu based on a set of predetermined items + +arr1 = ["Creamy", "Spicy", "Mild", "Succulent", "Dairy-free", "Sweet and sour", "Crispy", "Savory", "Hot", "Cold"] +arr2 = ["steamed", "grilled", "marinated", "BBQ-ed", "candied", "par-boiled", "poached", "baked", "vegan", "seared"] +arr3 = ["casserole", "sandwich", "quiche", "tacos", "salmon", "tofu", "brussel sprouts", "cheesecake", "ribs", "tabbouleh"] + +print "How many of the 10 menu items would you like to view? " + num = gets.chomp + +10.times do |i| + puts "#{i+1}. #{arr1.sample} #{arr2.sample} #{arr3.sample}" +end + +# shuffles arrays so it's a nonrepeating random list. +arr1_rand = arr1.shuffle +arr2_rand = arr2.shuffle +arr3_rand = arr3.shuffle + +10.times do |i| + puts "#{i+1}. #{arr1_rand[i]} #{arr2_rand[i]} #{arr3_rand[i]}" +end From cfccb643e2666aceb36df33c3c9e4bb23e152792 Mon Sep 17 00:00:00 2001 From: CheerOnMars <36147056+CheerOnMars@users.noreply.github.com> Date: Tue, 6 Feb 2018 15:59:55 -0800 Subject: [PATCH 2/2] Update wk1_random_menu_generator.rb --- wk1_random_menu_generator.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wk1_random_menu_generator.rb b/wk1_random_menu_generator.rb index fdbc4aa..aa9305d 100644 --- a/wk1_random_menu_generator.rb +++ b/wk1_random_menu_generator.rb @@ -4,8 +4,8 @@ arr2 = ["steamed", "grilled", "marinated", "BBQ-ed", "candied", "par-boiled", "poached", "baked", "vegan", "seared"] arr3 = ["casserole", "sandwich", "quiche", "tacos", "salmon", "tofu", "brussel sprouts", "cheesecake", "ribs", "tabbouleh"] -print "How many of the 10 menu items would you like to view? " - num = gets.chomp +#print "How many of the 10 menu items would you like to view? " +# num = gets.chomp 10.times do |i| puts "#{i+1}. #{arr1.sample} #{arr2.sample} #{arr3.sample}"