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

Ann Dai's random menu generator homework #22

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

Conversation

gofarann
Copy link

@gofarann gofarann commented Feb 9, 2017

Mood Analysis

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
Would a hash work just as well as an Array in this project? Why? Yes. 'rand' can still be used on a Hash to generate the dish names. However, I think a hash would add complexity to the code by needing a key for each user input. But perhaps key generation could also be generated which would eliminate the complexity. I think a Hash would work well if there were different kinds of menus each with 3 hashes. For example the dessert menu would pull from the hashes associated with the dessert key etc.
Did you find yourself repeating the same code? Why did you have to do it that way? Not within the same array. I used a loop to resolve for repetition of generating 10 menu items. however, I did have to repeat the same type of code to populate each of the 3 arrays. I believe creating a method could resolve for this.
What type of loop did you use? Why did you choose that type? I used 3 separate while loops to get user inputs to populate each array with 10 elements. I used 'while' because it allows me to specify conditionals in one line. An alternative would be to use 'case', however, I believe that is for more complex conditionals and was not necessary for this tool.

@kariabancroft
Copy link

Random Menu

What We're Looking For

Feature Feedback
Random Menu of 10 items displayed in the terminal. Yes! By using one loop to populate the array of menu items and a second loop to display them, you're potentially doing this loop an extra time. I think you could do both the population of the menu items and the display of them in one single loop.
Generator pulls one random item from each array to create menu items. Yep! Using the rand method with a range.
Baseline
Readable code with consistent indentation. Readability of code is good. Nice use of whitespace between blocks and comments.
Extras
Nice job using a while loop to check the length of the array that the user has selected. This is definitely a good way to do this.
Totally optional suggestion: You could potentially simplify your three different food types loops by using another loop outside of this one to execute three times. This would work if you created an array of arrays like [[], [], []] to collect each piece of information.

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.

3 participants