Skip to content
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

Queues - Anna Barklund - Random Menu #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

amb54
Copy link

@amb54 amb54 commented Feb 9, 2017

Random Menu

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
Would a hash work just as well as an Array in this project? Why? No, I do not think so. The choices were made randomly from each array.
Did you find yourself repeating the same code? Why did you have to do it that way? I repeated the sample method for each array, since an element was randomly pulled from each array.
What type of loop did you use? Why did you choose that type? A times loop. It looped through how many items on the menu that was requested by the user.

Copy link

@droberts-sea droberts-sea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random Menu

What We're Looking For

Feature Feedback                                                                              
Baseline
Random Menu of 10 items displayed in the terminal. Yes
Generator pulls one random item from each array to create menu items. Yes
Readable code with consistent indentation. Yes
Extras
Menu components are not repeated Yes
User can specify how many menu items to see Yes

item_number = 0

# Printing out the items one by one
number_of_items.times do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that a times loop gives you the current count as an iteration variable. So this loop could be rewritten as:

number_of_items.times do |n|
  # ...get adj_choise, style_choise and food_choise...
  puts "#{n+1}, #{adj_choise} #{style_choise} #{food_choise}"
end

Both ways will work, so do what makes sense for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants