From 4e1118368056ea21ad126214819fd63d89f4a32a Mon Sep 17 00:00:00 2001 From: laurenelee Date: Thu, 10 Aug 2017 09:16:19 -0700 Subject: [PATCH 1/5] Create generator_user_input.rb --- generator_user_input.rb | 48 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 generator_user_input.rb diff --git a/generator_user_input.rb b/generator_user_input.rb new file mode 100644 index 0000000..54e27a1 --- /dev/null +++ b/generator_user_input.rb @@ -0,0 +1,48 @@ +# welcome message and user input (choosing amount of menu items) +puts "Welcome to Lauren's Restaurant!" +puts "How many menu items would you like to see? (10 max)" +num = gets.chomp.to_i + +puts "Okay, if you'd like to see #{num} menu options, \nyou unfortunately need to come up with those options!" + +adj = [] +style = [] +protein = [] + +# Ask user to provide menu items and create array +puts "\nPlease provide #{num} adjectives: " +num.times do +adj << gets.chomp +end + +puts "Now, provide #{num} cooking styles: " +num.times do +style << gets.chomp +end + +puts "Lastly, provide #{num} foods: " +num.times do +protein << gets.chomp +end + +puts "Thank you for your input!" + +# to avoid duplicates, create a NEW array from OG array! +adj_arr = adj.shuffle +style_arr = style.shuffle +protein_arr = protein.shuffle + +# output message +# randomly pulls one item from each array +puts "\nBelow are your menu options:" +num.times do |i| + puts "#{i + 1}: #{adj_arr[i]} #{style_arr[i]} #{protein_arr[i]}" + i += 1 +end + +# attempt to create an array within array +# num.times do |i| +# arr_array = [adj_arr, style_arr, protein_arr] +# puts arr_array[][i][i] +# i += 1 +# end From 7d28d1a0e2e78339cbdbca066c01cbd795dc982f Mon Sep 17 00:00:00 2001 From: laurenelee Date: Thu, 10 Aug 2017 09:17:19 -0700 Subject: [PATCH 2/5] Create primary_requirements.rb --- primary_requirements.rb | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 primary_requirements.rb diff --git a/primary_requirements.rb b/primary_requirements.rb new file mode 100644 index 0000000..26aab00 --- /dev/null +++ b/primary_requirements.rb @@ -0,0 +1,42 @@ +# Come up with the three arrays of ten items each. +# Each list should be a different type of food +# or descriptor for that food. + +adj = %W[smelly creamy sticky stinky slimy strong stringy gooey pungent watery] +style = ["deep-fried", "steamed", "baked", "boiled", "caramelized", "charbroiled", "grilled", "marinated", "microwaved", "pan fried"] +protein = %W[steak chicken tacos kabobs beans tofu pork sandwiches bacon turkey] + +puts "Welcome to Lauren's Restaurant!" +puts "How many menu items would you like to see? (10 max)" +num = gets.chomp.to_i + +# to avoid duplicates, create a NEW array from OG array! +adj_arr = adj.shuffle +style_arr = style.shuffle +protein_arr = protein.shuffle + +# output message +# randomly pulls one item from each array +puts "\nBelow are your menu options:" +num.times do |i| + puts "#{i + 1}: #{adj_arr[i]} #{style_arr[i]} #{protein_arr[i]}" + i += 1 +end + +# ------ other things I tried: + +# First try: +# this works to meet primary requirements +# puts "\nBelow are your menu options:" +# 10.times do |i| +# puts "#{i}: #{adj.sample} #{style.sample} #{protein.sample}" +# i += 1 +# end + +# long winded way of eliminating duplicates +# for each (adj, style, and protein) +# adj_arr = [] +# until adj_arr.length == num do +# rand = adj.sample +# adj_arr.push(rand) unless adj_arr.include?(rand) +# end From 974680390dacbcc94544479047d14a85d871265f Mon Sep 17 00:00:00 2001 From: laurenelee Date: Thu, 10 Aug 2017 09:17:45 -0700 Subject: [PATCH 3/5] Update generator_user_input.rb --- generator_user_input.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generator_user_input.rb b/generator_user_input.rb index 54e27a1..1dbfe1c 100644 --- a/generator_user_input.rb +++ b/generator_user_input.rb @@ -12,17 +12,17 @@ # Ask user to provide menu items and create array puts "\nPlease provide #{num} adjectives: " num.times do -adj << gets.chomp + adj << gets.chomp end puts "Now, provide #{num} cooking styles: " num.times do -style << gets.chomp + style << gets.chomp end puts "Lastly, provide #{num} foods: " num.times do -protein << gets.chomp + protein << gets.chomp end puts "Thank you for your input!" From 6b14a048445373d5a1a3a82bf427ff6c633618af Mon Sep 17 00:00:00 2001 From: laurenelee Date: Thu, 10 Aug 2017 10:02:36 -0700 Subject: [PATCH 4/5] Update generator_user_input.rb --- generator_user_input.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/generator_user_input.rb b/generator_user_input.rb index 1dbfe1c..b821951 100644 --- a/generator_user_input.rb +++ b/generator_user_input.rb @@ -28,9 +28,8 @@ puts "Thank you for your input!" # to avoid duplicates, create a NEW array from OG array! -adj_arr = adj.shuffle -style_arr = style.shuffle -protein_arr = protein.shuffle +adj_arr, style_arr, protein_arr = adj.shuffle, style.shuffle, protein.shuffle + # output message # randomly pulls one item from each array From 3a3d0bda8ccde3bdeb42045b817799720b890867 Mon Sep 17 00:00:00 2001 From: laurenelee Date: Thu, 10 Aug 2017 21:52:47 -0700 Subject: [PATCH 5/5] Update generator_user_input.rb --- generator_user_input.rb | 59 +++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 37 deletions(-) diff --git a/generator_user_input.rb b/generator_user_input.rb index b821951..1baf022 100644 --- a/generator_user_input.rb +++ b/generator_user_input.rb @@ -8,40 +8,25 @@ adj = [] style = [] protein = [] - -# Ask user to provide menu items and create array -puts "\nPlease provide #{num} adjectives: " -num.times do - adj << gets.chomp -end - -puts "Now, provide #{num} cooking styles: " -num.times do - style << gets.chomp -end - -puts "Lastly, provide #{num} foods: " -num.times do - protein << gets.chomp -end - -puts "Thank you for your input!" - -# to avoid duplicates, create a NEW array from OG array! -adj_arr, style_arr, protein_arr = adj.shuffle, style.shuffle, protein.shuffle - - -# output message -# randomly pulls one item from each array -puts "\nBelow are your menu options:" -num.times do |i| - puts "#{i + 1}: #{adj_arr[i]} #{style_arr[i]} #{protein_arr[i]}" - i += 1 -end - -# attempt to create an array within array -# num.times do |i| -# arr_array = [adj_arr, style_arr, protein_arr] -# puts arr_array[][i][i] -# i += 1 -# end +array = [adj, style, protein] + +prompts = ["Now, provide #{num} adjectives: ", + "Now, provide #{num} cooking styles: ", + "Please provide #{num} foods: "] + + 3.times do |i| + puts "#{prompts[i-1]}" + num.times do + array[i] << gets.chomp + end + end + + puts "Below is the menu you created!" + adj_sample = array[2].sample(num) + style_sample = array[1].sample(num) + protein_sample = array[0].sample(num) + + num.times do |i| + puts "#{i + 1}: #{adj_sample[i]} #{style_sample[i]} #{protein_sample[i]}" + i += 1 + end