Skip to content

Create random_menu.rb #28

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

Conversation

kimpossible1
Copy link

Random Menu

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
How did you store menu components? Why? in arrays
Could you have stored components using a different data structure? For example, if you used an Array could you have used a Hash? Yes, I believe it is possible to store the data in a hash(es), but I think it would make the process more complicated for randomization. I think arrays would be the most efficient.
Did you find yourself repeating the same code? Why did you have to do it that way? When I first thought about it, my code would have been more repetitive, but I thought about how to make it more efficient and I did find a way. I don't think I repeated the same code much.
What type of loop did you use? Why did you choose that type? For the basic project I used a times do loop. For the optionals I used 2 until loops and a do loop. The purpose of the until loops is to obtain the input from the user: number of food items and then the actual food items. The times do loop prints the random menu items according to number of food items.

@droberts-sea
Copy link
Collaborator

Random Menu

What We're Looking For

Feature Feedback
Random Menu of 10 items displayed in the terminal. Yes
Generator pulls one random item from each array to create menu items. Yes
Baseline
Readable code with consistent indentation. Mostly - see inline comment

Great work overall. Good job on the optionals.


until food.length == num_items
puts "Please enter one food item you have to offer (ex: chicken, root vegetables, squash...)."
food << gets.chomp.upcase
Copy link
Collaborator

Choose a reason for hiding this comment

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

Watch your indentation here - the inside of a loop should be two spaces in.


adjectives.shuffle!
cooking_method.shuffle!
food.shuffle!
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good use of shuffle.

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

Successfully merging this pull request may close these issues.

2 participants