diff --git a/random_menu_generator_v1.rb b/random_menu_generator_v1.rb new file mode 100644 index 0000000..7c2e678 --- /dev/null +++ b/random_menu_generator_v1.rb @@ -0,0 +1,27 @@ +# Random Menu Generator +# produces random Menu +# with user-selected number of items + +# produces 3 arrays with food descriptors +adjectives = ["spicy", "tangy", "sweet", "seasonal", "crunchy", "sour", "soft", "creamy", "brittle", "cold"] +cooking_style = ["sauteed", "fried", "frozen", "seared", "pan-fried", "well-done", "baked", "stir-fried", "steamed", "curried" ] +food = ["cake", "tacos", "pizza", "ice cream", "clams", "tater tots", "chicken tenders", "tuna", "steak", "tofu"] + +# asks user for number of menu items (10 or fewer) +puts "How many items would you like on your menu? Please choose a value less than or equal to 10." +items = gets.to_i + +# confirms whether user input is valid +while items <= 0 || items > 10 + puts "Please provide a number less than 10 and greater than 0" + items = gets.to_i +end + +# creates list of non-repeating numbered menu items +puts "Great! Here is your Menu:" +adjectives = adjectives.shuffle +cooking_style = cooking_style.shuffle +food = food.shuffle +items.times do |n| + puts "#{n+1}. #{adjectives[n]} #{cooking_style[n]} #{food[n]}" +end diff --git a/random_menu_generator_v2.rb b/random_menu_generator_v2.rb new file mode 100644 index 0000000..d33cacd --- /dev/null +++ b/random_menu_generator_v2.rb @@ -0,0 +1,36 @@ +# Random Menu Generator +# produces random Menu +# with user-selected number of items + +# Introduces Menu Generator +puts "Welcome to the Random Menu Generator" +puts "How many items would you like on your menu? (please choose a number less than 10 and greater than 0)" +items = gets.to_i + +# confirms whether user input is valid +while items <= 0 || items > 10 + puts "Please provide a number less than 10 and greater than 0" + items = gets.to_i +end + +# instantiate empty arrays +adjectives, cooking_style, food = [], [], [] + +# produces items arrays based on user input +items.times do |n| + puts "Please provide an adjective to describe food" + adjectives[n] = gets.chomp + puts "Please provide a cooking style to describe food" + cooking_style[n] = gets.chomp + puts "Please provide a food" + food[n] = gets.chomp +end + +# creates list of non-repeating numbered menu items +puts "Great! Here is your Menu:" +adjectives = adjectives.shuffle +cooking_style = cooking_style.shuffle +food = food.shuffle +items.times do |n| + puts "#{n+1}. #{adjectives[n]} #{cooking_style[n]} #{food[n]}" +end