Skip to content

carets Julia Meier - Random Menu Generator #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions 2017-08-09_Random_Menu_Generator_Optional_2.rb
Original file line number Diff line number Diff line change
@@ -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