forked from Ada-C9/Random-Menu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraft_assignment_1.rb
More file actions
61 lines (43 loc) · 1.86 KB
/
draft_assignment_1.rb
File metadata and controls
61 lines (43 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
=begin
This is assignment 1 for Ada cohort 9
Assigned: 18-2-05 pm
Due: 18-2-06 am (before class)
Specs:
OVERALL: Randomly access the contents of 3 10-item arrays to produce a
10-item menu.
SPECIFICS: * Each item should be in the format "Adj, cookingstyle, foodnoun"
* Should run in the terminal
* Should be a numbered list of 1-10 beginning with 1
* Each array-item should be used exactly once.
* Should accept user input (OPTIONAL)
* Should allow the user to specify the number of menu items they
want to see. (OPTIONAL)
=end
# CREATION OF THE NECESSARY arrays
initial_adjectives = %w[non-alcoholic hopeless questionable salty crispy bankrupt
sentient bioluminescent wrong-headed artisanal]
initial_cookstyles = %w[refactored manifold-roasted smashed cheese-slathered
spatchcocked bedazzled deep-fried beer-battered macerated unpeeled]
initial_foodnouns = %w[brie pheasant potatoes tofurkey parsnips
purslane monkfish watercress trout caviar]
# RANDOMLY SORT ARRAYS
random_adjectives = initial_adjectives.sort_by {rand}
random_cookstyles = initial_cookstyles.sort_by {rand}
random_foodnouns = initial_foodnouns.sort_by {rand}
#JUST FOR TESTING:
#puts random_adjectives.inspect
# INTRODUCE PROGRAM AND GREET USER
puts "\n\nWelcome to the STOCHASTIC SAVORIES!\n\n"
puts "Here, you can order from an array (heh) of different dishes, including:\n\n"
# CREATE DISH NAMES AND STORE IN NEW ARRAY
all_dish_names = []
10.times do |i|
temp_dishname = random_adjectives[i].capitalize + ", " + random_cookstyles[i] + " " + random_foodnouns[i]
all_dish_names << temp_dishname
end
# PRINT OUT THE LIST OF DISH NAMES
all_dish_names.each_with_index do |dish, counter|
puts "\t#{counter + 1}. #{dish}"
end
# THANK THE USER AND CLOSE
puts "\n\nThanks for visiting STOCHASTIC SAVORIES!"