From eb138ba10f872997ba170894ebbbd89dbfcba73d Mon Sep 17 00:00:00 2001 From: Ashtn Date: Thu, 9 Feb 2017 09:11:09 -0800 Subject: [PATCH 1/2] Create random_menu.rb --- random_menu.rb | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 random_menu.rb diff --git a/random_menu.rb b/random_menu.rb new file mode 100644 index 0000000..ff21ae9 --- /dev/null +++ b/random_menu.rb @@ -0,0 +1,40 @@ +# Come up with the three arrays of ten items each. + +puts "Welcome to Random Menu Generator! " +puts "If you're hungry and would like to see a randomly +selected menu! Please type yes!" +# accepts input that will que program to run +generate = gets.chomp.downcase + +# first array of adjectives +adjectives = [ "swaggy", "small", "green", "hallow", "opaque", "burnt", "huge", "wet", "dry", "long" ] + +#second array of cooking styles +styles =[ "fried", "wet", "brolied", "baked", "braised", "deep fried", "roasted", "dry", "raw"] + +#third foods +foods = [ "eggs", "chicken", "toast", "sandwhich", "handburger", "kale salad", "smoothie", "pasta", "soup", "oysters"] + +# Create a random menu generator that can be played from the Terminal. + +#variable to store the numbered list used in output +number = 0 + +# the progam will start when the user inputs yes. +if generate == "yes" + #10 times the loop will pull a value of a random index from each array of the 3 arrays, interpolate those values into a string . + 10.times do + # incresed the number of the ordered list by 1 each iteration + number += 1 + puts "#{number}. #{adjectives[rand(0..9)].} #{styles[rand(0..9)]} #{foods[rand(0..9)]}" + end +end + + + + + + +# Your generator should pull one item from each array you made in the baseline requirements to create a "menu item". + +# When the program runs, it should create and show a list of ten numbered menu items. From 51fc05033f362ce8736ad87fa2a18f22481b7e65 Mon Sep 17 00:00:00 2001 From: Ashtn Date: Thu, 9 Feb 2017 09:47:36 -0800 Subject: [PATCH 2/2] Update random_menu.rb found a random period that makes my code not work =/ --- random_menu.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/random_menu.rb b/random_menu.rb index ff21ae9..5487f4f 100644 --- a/random_menu.rb +++ b/random_menu.rb @@ -26,7 +26,7 @@ 10.times do # incresed the number of the ordered list by 1 each iteration number += 1 - puts "#{number}. #{adjectives[rand(0..9)].} #{styles[rand(0..9)]} #{foods[rand(0..9)]}" + puts "#{number}. #{adjectives[rand(0..9)]} #{styles[rand(0..9)]} #{foods[rand(0..9)]}" end end