From c7fbc3b43f6316b8fdd1c85cef9ca8f989ab59c7 Mon Sep 17 00:00:00 2001 From: julmeier Date: Thu, 10 Aug 2017 09:20:30 -0700 Subject: [PATCH 1/3] carets Julia - Random Menu Generator --- 2017-08-09_Random_Menu_Generator_Optional.rb | 31 ++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 2017-08-09_Random_Menu_Generator_Optional.rb diff --git a/2017-08-09_Random_Menu_Generator_Optional.rb b/2017-08-09_Random_Menu_Generator_Optional.rb new file mode 100644 index 0000000..6cd3c51 --- /dev/null +++ b/2017-08-09_Random_Menu_Generator_Optional.rb @@ -0,0 +1,31 @@ +#Random Menu Generator +# https://github.com/Ada-C8/Random-Menu + +max_items = 10 +items = max_items + 1 + +until items <= max_items +puts "How many menu items would you like to see today? We have only up to #{max_items} foods to offer." +items = gets.chomp.to_i +end + +puts "Here are our #{items} items on today's menu:" +puts " " + +adjectives = ["slimy", "spicy", "gelatinous", "umami", "sweet", "salty", "bitter", "sugary", "lightly", "hard" ] +cooking_style = ["fried", "baked", "sauteed", "broiled", "stewed", "grilled", "julienned", "chopped", "pureed", "fire-roasted"] +foods = ["eggs", "chicken", "octopus", "cod", "eggplant", "salmon", "parsnips", "brussel sprouts", "field roast", "tofu"] + +menu_item = 0 + +items.times do |x| + + menu_item = menu_item + 1 + puts "Menu Item No. #{menu_item}:" + + adj = adjectives.sample + puts adj + " " + cooking_style.sample + " " + foods.sample + + adjectives.delete(adj) + +end From 3590c0258c34ac70d5a206f614b6c38a284802da Mon Sep 17 00:00:00 2001 From: julmeier Date: Thu, 10 Aug 2017 10:05:30 -0700 Subject: [PATCH 2/3] Julia Meier Random Menu Generator 2 --- ...-08-09_Random_Menu_Generator_Optional_2.rb | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 2017-08-09_Random_Menu_Generator_Optional_2.rb diff --git a/2017-08-09_Random_Menu_Generator_Optional_2.rb b/2017-08-09_Random_Menu_Generator_Optional_2.rb new file mode 100644 index 0000000..1749851 --- /dev/null +++ b/2017-08-09_Random_Menu_Generator_Optional_2.rb @@ -0,0 +1,56 @@ +#Random Menu Generator +# https://github.com/Ada-C8/Random-Menu + +# Gets the sizes of each of the arrays from the user +puts "how many types of adjectives do you want on the menu?" +user_adj = gets.chomp.to_i + +puts "how many types of cooking styles do you want on the menu?" +user_styles = gets.chomp.to_i + +puts "how many types of foods do you want on the menu?" +user_foods = gets.chomp.to_i + +# initializes the arrays +adjectives = [] +cooking_style = [] +foods = [] + +# collects array data from user +user_adj.times do |x| + puts "please enter adjective #{x+1}:" + enter_adj = gets.chomp + adjectives << enter_adj +end + +user_styles.times do |x| + puts "please enter cooking style #{x+1}:" + enter_adj = gets.chomp + cooking_style << enter_adj +end + +user_foods.times do |x| + puts "please enter food type #{x+1}:" + enter_adj = gets.chomp + foods << enter_adj +end + + +# Gets the number of menu items from the user. Rejects if the number of menu items exceeds the number of adjectives entered in the adjectives array. +items = user_adj + 1 + +until items <= user_adj + puts "How many menu items would you like to see today? We have only up to #{user_adj} menu items to offer with unique adjectives." + items = gets.chomp.to_i +end + +# Displays menu +puts "Here are our #{items} items on today's menu:" +puts " " + +items.times do |x| + puts "Menu Item No. #{x+1}" + adj = adjectives.sample + puts adj + " " + cooking_style.sample + " " + foods.sample + adjectives.delete(adj) +end From eb7410aa1bf1d4ed80a820b4649a40a8cafd8dd0 Mon Sep 17 00:00:00 2001 From: julmeier Date: Fri, 11 Aug 2017 13:58:15 -0700 Subject: [PATCH 3/3] Delete 2017-08-09_Random_Menu_Generator_Optional.rb --- 2017-08-09_Random_Menu_Generator_Optional.rb | 31 -------------------- 1 file changed, 31 deletions(-) delete mode 100644 2017-08-09_Random_Menu_Generator_Optional.rb diff --git a/2017-08-09_Random_Menu_Generator_Optional.rb b/2017-08-09_Random_Menu_Generator_Optional.rb deleted file mode 100644 index 6cd3c51..0000000 --- a/2017-08-09_Random_Menu_Generator_Optional.rb +++ /dev/null @@ -1,31 +0,0 @@ -#Random Menu Generator -# https://github.com/Ada-C8/Random-Menu - -max_items = 10 -items = max_items + 1 - -until items <= max_items -puts "How many menu items would you like to see today? We have only up to #{max_items} foods to offer." -items = gets.chomp.to_i -end - -puts "Here are our #{items} items on today's menu:" -puts " " - -adjectives = ["slimy", "spicy", "gelatinous", "umami", "sweet", "salty", "bitter", "sugary", "lightly", "hard" ] -cooking_style = ["fried", "baked", "sauteed", "broiled", "stewed", "grilled", "julienned", "chopped", "pureed", "fire-roasted"] -foods = ["eggs", "chicken", "octopus", "cod", "eggplant", "salmon", "parsnips", "brussel sprouts", "field roast", "tofu"] - -menu_item = 0 - -items.times do |x| - - menu_item = menu_item + 1 - puts "Menu Item No. #{menu_item}:" - - adj = adjectives.sample - puts adj + " " + cooking_style.sample + " " + foods.sample - - adjectives.delete(adj) - -end