Skip to content

Commit f2b57bf

Browse files
committedJun 10, 2014
Merge pull request #2 from tmitche831/master
Let me know if you have any questions
2 parents 32f0f4a + e91fe79 commit f2b57bf

File tree

5 files changed

+615
-0
lines changed

5 files changed

+615
-0
lines changed
 
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Calculator
2+
3+
###Objectives:
4+
- Practice with functions, loops, conditions, user-input, switch/case
5+
6+
###Activity:
7+
- Students should work on this lab in groups.
8+
9+
###Explanation
10+
- You will be building a calculator. A calculator can perform multiple arithmetic operations. Your function should allow the user to choose which operation is expected, enter in the values to perform the operation on, and ultimately view the result.
11+
- The instructor should carefully step through the lab with the students, as they type out the requirements for each specification.
12+
- Consider having the students make git commits as they finish each phase, so they can see the history
13+
14+
###Specification:
15+
- A user should be given a menu of operations
16+
- A user should be able to choose from the menu
17+
- A user should be able to enter numbers to perform the operation on
18+
- A user should be shown the result
19+
- This process should continue until the user selects a quit option from the menu
20+
21+
#####Phase 1
22+
- Calculator functionality
23+
- Calculator should be able to do basic arithmetic (+,-, *, /)
24+
25+
#####Phase 2
26+
- Advanced Calculator functionality
27+
- Calculator should be able to do basic arithmetic (exponents, square roots)
28+
29+
#####Phase 3
30+
- User should be given a menu of Calculator functionality
31+
- User should be able to choose indented functionality
32+
33+
## Mortgage & BMI Calculators
34+
35+
Add additional features to your calculators:
36+
37+
* [Mortgage:](http://www.wikihow.com/Sample/Mortgage-Payment)
38+
* Calculate the monthly payment when given the other variables as input.
39+
* [BMI:](http://www.wikihow.com/Image:BMI.jpg)
40+
* Calculate the BMI when given the height and weight.
41+
42+
## Trip Calculator
43+
44+
* This option asks the user for four inputs:
45+
* Distance – how far will you drive?
46+
* MPG – what is the fuel efficiency of the car?
47+
* $PG – how much does gas cost per gallon?
48+
* Speed – how fast will you drive?
49+
50+
* The output is a string: "Your trip will take 3.5 hours and cost $255.33."
51+
* For every 1 MPH over 60 MPH, reduce the the MPG by 2 MPG. (i.e. a car that normally gets 30 mpg would only get 28 mpg if its speed were 61 mph. Yes this gets silly at high speed where mpg goes to zero or gets negative.)

‎hackers/tommy_mitchell/wk1d2/calc.rb

+265
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
2+
# ____ ____ _ ____ _ _ ____ _____ ____ ____
3+
# / _\/ _ \/ \ / _\/ \ /\/ \ / _ Y__ __Y _ \/ __\
4+
# | / | / \|| | | / | | ||| | | / \| / \ | / \|| \/|
5+
# | \__| |-||| |_/\| \__| \_/|| |_/\| |-|| | | | \_/|| /
6+
# \____/\_/ \|\____/\____/\____/\____/\_/ \| \_/ \____/\_/\_\
7+
8+
def mainmenu
9+
puts "would you like to use (a)dvanced, (b)asic, mort(g)age, b(mi), (t)rip or (e)xit"
10+
response = gets.chomp
11+
end
12+
13+
def basic_calc
14+
puts "(a)dd, (s)ubtract, (m)ultiply, (d)ivide: "
15+
end
16+
17+
def advanced_calc
18+
puts "(p)ower, sq(r)t: "
19+
end
20+
21+
def mortgage_calc
22+
puts "mort(g)age calculator: "
23+
end
24+
25+
def bmi_calc
26+
puts "b(mi) calculator:"
27+
end
28+
29+
def trip_calc
30+
puts "(t)rip calculator"
31+
end
32+
33+
def exit
34+
puts "do you really want to (q)uit? "
35+
end
36+
37+
# _
38+
# //
39+
# //
40+
# __/(
41+
# _.~-a ~-.
42+
# {_____) `. _..=~~~~=._
43+
# ~-_ \ _.=~ '=.
44+
# \ `._.=~ .=. :=._
45+
# - __ ( \ : \)
46+
# ~. ( } ( | : :
47+
# `: \ \ \ |\ ; :
48+
# \ \ } \ / | ; }
49+
# `-.__//__.==~~=._\ (_/ ; ;
50+
# // | |/ ; ;
51+
# {{ _____|_/ ; ; * ___
52+
# ` ---- _=.=` ~ _____ ||* ____
53+
# __:=' .=' ___\\||/___
54+
# "Parasaurolophus" ..:~____.==''
55+
56+
57+
58+
response = mainmenu # adv_calc, bas_calc, mort_calc, trip_calc and exit
59+
60+
if response == 'a'
61+
advanced_calc
62+
elsif response == 'b'
63+
basic_calc
64+
elsif response == 'g'
65+
mortgage_calc
66+
elsif response == 'mi'
67+
bmi_calc
68+
elsif response == 't'
69+
trip_calc
70+
elsif response == 'e'
71+
exit
72+
end
73+
74+
# ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▄░░░░░
75+
# ░░░░░░░▄▄▄▀▀▀▀▀█▄▄▄▄░░░░░░░░░░░░░░█▄░░░░
76+
# ░░░░▄█▀▀░░░░░░░░░░░▀▀█▄▄▄▄▄▄▄░░░░░█▀▄░░░
77+
# ░░▄██▄░░░░░░░░░░░░░░░░░▀▄░░░▀▀▀▀███▄█░░░
78+
# ▄█▀▀░▀▀█▄░░░░░░▄█▀▀█▄▄░░▀█░░░░░░░░░▀█▄░░
79+
# ██░░░░░▄█▄▄▄▄▄█▀░░░░░██░░█▄░░░░░░░░░░▀▄░
80+
# ██▄░░▄▀▀░░░░░▀▀▄▄░░░░██▄░░█░░░░░░░░░░░█▄
81+
# █████▀░░▄▄▄▄░░░░▀▄▄▄███░░░█░░░░░░░░░░░░█
82+
# ░███▀░░██████░░░░████▀█▄░▄▀░░░░░░░░░░░░█
83+
# ░░██░░░░█▀▀▀█░░░░░█░░░░▀▀▀░░░░░░░░░░░░▄█
84+
# ░░█▀█░░░█▀▀▀█░░░░░█░░░░░░░░░░░░░░░░░░░█░
85+
# ░░▀█▀▄▄█▀░░░▀█░░░█▀░░░░░░░░░░░░░░░░░▄█░░
86+
# ░░░▀█░░░░░░░░░▀▀▀░░░░░░░░░░░░░░░▄▄██░█░░
87+
# ░░░░░██▄░░░░░░░░░░░░░░░░░░░▄▄▄█▀▀░██░█░░
88+
# ░░░░░█░▀█▀▀▀█▄▄▄▄▄▄▄▄▄▄██▀██░░░░░░██░█░░
89+
# ░░░░░█░░█░░░░░░░░█░░█░░░█░██░░░░░░██░█░░
90+
# ░░▄▄▄█░░█░░░░░▄▄▄█░░█░▄█▀░██░░░░░▄██░█░░
91+
# ░▀█▄▄▄▄▄█░░░░░█▄▄▄▄▄█░░▀▄▀▀░░░░░░█▄▄▄█░░
92+
93+
basic_calc = gets.chomp #crucial, no idea why. WHY DOES THIS NEED TO BE HERE?
94+
case basic_calc
95+
when "a" # adding
96+
puts "Enter two numbers "
97+
x = gets.chomp.to_i
98+
y = gets.chomp.to_i
99+
puts "=" + (x + y).to_s
100+
mainmenu
101+
102+
when "s" # subtracting
103+
puts "Enter two numbers "
104+
x = gets.chomp.to_i
105+
y = gets.chomp.to_i
106+
puts "=" + (x - y).to_s
107+
mainmenu
108+
109+
when "m" #multiplying
110+
puts "Enter two numbers "
111+
x = gets.chomp.to_i
112+
y = gets.chomp.to_i
113+
puts "=" + (x * y).to_s
114+
mainmenu
115+
116+
when "d" #dividing
117+
puts "Enter two numbers "
118+
x = gets.chomp.to_f
119+
y = gets.chomp.to_f
120+
puts "=" + (x / y).to_s
121+
mainmenu
122+
123+
when "p" #power
124+
puts "Enter two numbers "
125+
x = gets.chomp.to_f
126+
y = gets.chomp.to_f
127+
puts "=" + (x ** y).to_s
128+
mainmenu
129+
130+
when "r" #sqaure root
131+
puts "Enter number "
132+
x = gets.chomp.to_f
133+
puts "=" + Math.sqrt(x).to_s
134+
mainmenu
135+
136+
when "g" #mortgage
137+
puts "Enter principle of loan "
138+
p = gets.chomp.to_f
139+
puts "Enter annual interest rate "
140+
i = gets.chomp.to_f / 100 / 12
141+
puts "Enter number of payments"
142+
n = gets.chomp.to_f
143+
puts "=" + m = ( ( (i * ( ( 1 + i ) ** n ) ) / ( ( ( 1 + i ) ** n ) - 1 )) * p ).to_s
144+
mainmenu
145+
146+
when "mi" #bmi
147+
puts "enter height"
148+
ht = gets.chomp.to_f
149+
puts "enter weight"
150+
wt = gets.chomp.to_f
151+
bmi = ( (wt) / ( (ht) * (ht) ) ).to_s #calculating the bmi
152+
puts "your bmi is #{bmi}"
153+
mainmenu
154+
155+
when 't' #trip
156+
puts "enter distance"
157+
d = gets.to_f
158+
puts "how many miles to the gallon? "
159+
mpg = gets.to_f
160+
puts "how much does fuel cost per gallon?"
161+
$pg = gets.to_f
162+
puts "enter speed"
163+
speed = gets.to_f
164+
165+
if speed > 60
166+
for speed in (61..speed) # loop code "For every 1 MPH over 60 MPH, reduce the the MPG by 2 MPG."
167+
mpg -= 2
168+
end
169+
end
170+
171+
time = (d / speed)
172+
cost = (mpg * $pg)
173+
puts "Your trip will take #{ time } hours and cost $#{ cost }."
174+
mainmenu
175+
end
176+
177+
178+
179+
180+
# ,+######:
181+
# `###;:::::::;###`
182+
# :##:::::::::::::::##`
183+
# `#+:::::::::::::::::::##
184+
# ##::::::::::::::::::::::##
185+
# #;::::::::::::::::::::::::;# '##
186+
# #::::::::::::::::::::::::::::# '+##
187+
# #:::::::::::::::::::::::::::::;# +###
188+
# #::::+##+:::::::::::::::;##+::::+# #;:;,
189+
# #:::##. ,#;::::::::::::#' .##:::#. '::::
190+
# ,+::## #;::::::::::## '#:::# .:::+
191+
# #:::#. #:::::::::## #:::++ #::#
192+
# .;::## `'::::::::## #:::# #::+.
193+
# #:::## #:::::::### #:::#' #:::,
194+
# #:::## ###+''##### #::::# ;:::;
195+
# ':::## #;::::::::## #::::#. :::#
196+
# ;::::### #:::::::::::;# #::::#, '::#
197+
# #::::;### #:::::::::::::## ;#::::;' #::#.
198+
# #:':::####'.':::::::::::::::#######:::'::# #::+,
199+
# #:+::::######:::::#####:::::######::::'::# +::;,
200+
# #:+:::::####+::::+#####+:::::####:::::'::# ::::;
201+
# #:'::::::::'::::::#####::::::#::::::::;:;; :::+
202+
# #;'::::::::#::::::':;:;::::::#::::::::;##, :::#
203+
# :#::::::::#:::::;;:::'::::::#::::::::::,` '::#
204+
# #:::::::::#:::::# ;:. ;:::::#:::::::::' +::#`
205+
# #::::::::::#:::::#'#.'##:::::#:::::::::# #::#`
206+
# #:::::::::::#:::::###+++#:::::#:::::::::+# #::#`
207+
# #:::'::::::::#::::##:,;+#+:::::':::::::::#:+ +::#`
208+
# #:::#:::::::::+::::#:+###::':::#::::::::::#::+ '::#`
209+
# #:::##::::::::::#+:#::::::::;+;#:::::::::::#::;+ ;::#`
210+
# #:::';#:::::::::::::::::::::::::::::::::::::#;::;# ::::+
211+
# ';:::',#:::::::::::::::::::::::::::::::::::::##;:::#;.#:::,
212+
# `+:::#, #:::::::::::::::::::::::::::::::::::::#`#:::::::::+,
213+
# #:::#,` #:::::::::::::::::::::::::::::::::::::#` #;:::::::#,
214+
# #:::#,. #:::::::::::::::::::::::::::::::::::::#` '#:::::#,
215+
# ,::::;, #:::::::::::::::::::::::::::::::::::::#` ,##;'#,,
216+
# #:::#, #:::::::::::::::::::::::::::::::::::::#` ,,,,,
217+
# #:::#,` #:::::::::::::::::::::::::::::::::::::#`
218+
# ;:::;, #:::::::::::::::::::::::::::::::::::::#`
219+
# #:::#, #:::::::::::::::::::::::::::::::::::::#`
220+
# :::;,` #:::::::::::::::::::::::::::::::::::::#`
221+
# #:::#, #::::::::::::::::::::::::::::::::::::;+
222+
# #:::,` #::::::::::::::::::::::::::::::::::::''
223+
# +::+, #::::::::::::::::::::::::::::::::::::+:
224+
# +:::+ #::::::::::::::::::::::::::::::::::::#,
225+
# #::::#` :#;:::::::::::::::::::::::::::::::::::#,
226+
# +:::::##: :::#:::::::::::::::::::::::::::::::::::#,
227+
# .#::::::::::#+;::::::::::::::::::::::::::::::::::#,
228+
# .##::::::::'+#::::::::::::::::::::::::::::::::::'`
229+
# ,'##'::::::':::::::::::::::::::::::::::::::::#,
230+
# ,,,:'++::#:::::::::::::::::::::::::::::::::#,
231+
# ``.#+#::::::::::::::::::::::::::::::::#,`
232+
# ,`#:::::::::::::::::::::::::::::::#,
233+
# `#:::::::::::::::::::::::::::::#,
234+
# `#:::::::::::::::::::::::::::#,.
235+
# `+#::::::::::::::::::::::::;,,
236+
# #:::::::::::::::::::::::::'
237+
# #::#+:::::::::::::::;#+:::#
238+
# +:;,,;##+:::::::'###,,,;::#`
239+
# ;:+, .,,:+###+',,,,. +::#.
240+
# .::#, `.,,,.` #::+,
241+
# :::#, #::',
242+
# '::#, #::;:
243+
# #::#. #::;'
244+
# #::#. #:::'
245+
# #::#. #:::'
246+
# #::#. #:::+
247+
# #::#. #:::+
248+
# #::#, #::;'
249+
# #::#, #::;'
250+
# #::#, #::';
251+
# #::#, #::':
252+
# #::+, #::+,
253+
# '::;' #::#,
254+
# ::::# #::#,
255+
# ;::# #::#,
256+
# +::#` +::#,
257+
# #::#. `'::#.
258+
# #::+, :;::#`
259+
# ,#:::+, ':::#+
260+
# .#::::#, `#:::#;
261+
# #::::#,, ##:::#
262+
# #+;##,, ;#+:#,
263+
# ;',,. ,:+;,
264+
# .` `.
265+
#
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
3+
lines = {
4+
:n => {'times square' => 1, '34th' => 2, 'n_28th' => 3, 'n_23rd' => 4, 'union square' => 5, '8th' => 6},
5+
:l => {'8th' => 1, '6th' => 2, 'union square' => 3, '3rd' =>4, '1st' => 5},
6+
:l6 => {'grand central' => 1, '33rd' => 2, '6_28th' => 3, '6_23rd' => 4, 'union square' => 5, 'astor place' => 6}
7+
}
8+
9+
p "What line are you on? n, l or l6"
10+
line_menu = gets.chomp
11+
p "what station will you depart from?"
12+
location_og = gets.chomp
13+
p "what line is your destination on? ( n, l, l6)"
14+
dest_line = gets.chomp
15+
p "what station are you going to on this line?"
16+
dest_station = gets.chomp
17+

‎homework/wk1d2/calc.rb

+265
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
2+
# ____ ____ _ ____ _ _ ____ _____ ____ ____
3+
# / _\/ _ \/ \ / _\/ \ /\/ \ / _ Y__ __Y _ \/ __\
4+
# | / | / \|| | | / | | ||| | | / \| / \ | / \|| \/|
5+
# | \__| |-||| |_/\| \__| \_/|| |_/\| |-|| | | | \_/|| /
6+
# \____/\_/ \|\____/\____/\____/\____/\_/ \| \_/ \____/\_/\_\
7+
8+
def mainmenu
9+
puts "would you like to use (a)dvanced, (b)asic, mort(g)age, b(mi), (t)rip or (e)xit"
10+
response = gets.chomp
11+
end
12+
13+
def basic_calc
14+
puts "(a)dd, (s)ubtract, (m)ultiply, (d)ivide: "
15+
end
16+
17+
def advanced_calc
18+
puts "(p)ower, sq(r)t: "
19+
end
20+
21+
def mortgage_calc
22+
puts "mort(g)age calculator: "
23+
end
24+
25+
def bmi_calc
26+
puts "b(mi) calculator:"
27+
end
28+
29+
def trip_calc
30+
puts "(t)rip calculator"
31+
end
32+
33+
def exit
34+
puts "do you really want to (q)uit? "
35+
end
36+
37+
# _
38+
# //
39+
# //
40+
# __/(
41+
# _.~-a ~-.
42+
# {_____) `. _..=~~~~=._
43+
# ~-_ \ _.=~ '=.
44+
# \ `._.=~ .=. :=._
45+
# - __ ( \ : \)
46+
# ~. ( } ( | : :
47+
# `: \ \ \ |\ ; :
48+
# \ \ } \ / | ; }
49+
# `-.__//__.==~~=._\ (_/ ; ;
50+
# // | |/ ; ;
51+
# {{ _____|_/ ; ; * ___
52+
# ` ---- _=.=` ~ _____ ||* ____
53+
# __:=' .=' ___\\||/___
54+
# "Parasaurolophus" ..:~____.==''
55+
56+
57+
58+
response = mainmenu # adv_calc, bas_calc, mort_calc, trip_calc and exit
59+
60+
if response == 'a'
61+
advanced_calc
62+
elsif response == 'b'
63+
basic_calc
64+
elsif response == 'g'
65+
mortgage_calc
66+
elsif response == 'mi'
67+
bmi_calc
68+
elsif response == 't'
69+
trip_calc
70+
elsif response == 'e'
71+
exit
72+
end
73+
74+
# ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▄░░░░░
75+
# ░░░░░░░▄▄▄▀▀▀▀▀█▄▄▄▄░░░░░░░░░░░░░░█▄░░░░
76+
# ░░░░▄█▀▀░░░░░░░░░░░▀▀█▄▄▄▄▄▄▄░░░░░█▀▄░░░
77+
# ░░▄██▄░░░░░░░░░░░░░░░░░▀▄░░░▀▀▀▀███▄█░░░
78+
# ▄█▀▀░▀▀█▄░░░░░░▄█▀▀█▄▄░░▀█░░░░░░░░░▀█▄░░
79+
# ██░░░░░▄█▄▄▄▄▄█▀░░░░░██░░█▄░░░░░░░░░░▀▄░
80+
# ██▄░░▄▀▀░░░░░▀▀▄▄░░░░██▄░░█░░░░░░░░░░░█▄
81+
# █████▀░░▄▄▄▄░░░░▀▄▄▄███░░░█░░░░░░░░░░░░█
82+
# ░███▀░░██████░░░░████▀█▄░▄▀░░░░░░░░░░░░█
83+
# ░░██░░░░█▀▀▀█░░░░░█░░░░▀▀▀░░░░░░░░░░░░▄█
84+
# ░░█▀█░░░█▀▀▀█░░░░░█░░░░░░░░░░░░░░░░░░░█░
85+
# ░░▀█▀▄▄█▀░░░▀█░░░█▀░░░░░░░░░░░░░░░░░▄█░░
86+
# ░░░▀█░░░░░░░░░▀▀▀░░░░░░░░░░░░░░░▄▄██░█░░
87+
# ░░░░░██▄░░░░░░░░░░░░░░░░░░░▄▄▄█▀▀░██░█░░
88+
# ░░░░░█░▀█▀▀▀█▄▄▄▄▄▄▄▄▄▄██▀██░░░░░░██░█░░
89+
# ░░░░░█░░█░░░░░░░░█░░█░░░█░██░░░░░░██░█░░
90+
# ░░▄▄▄█░░█░░░░░▄▄▄█░░█░▄█▀░██░░░░░▄██░█░░
91+
# ░▀█▄▄▄▄▄█░░░░░█▄▄▄▄▄█░░▀▄▀▀░░░░░░█▄▄▄█░░
92+
93+
basic_calc = gets.chomp #crucial, no idea why. WHY DOES THIS NEED TO BE HERE?
94+
case basic_calc
95+
when "a" # adding
96+
puts "Enter two numbers "
97+
x = gets.chomp.to_i
98+
y = gets.chomp.to_i
99+
puts "=" + (x + y).to_s
100+
mainmenu
101+
102+
when "s" # subtracting
103+
puts "Enter two numbers "
104+
x = gets.chomp.to_i
105+
y = gets.chomp.to_i
106+
puts "=" + (x - y).to_s
107+
mainmenu
108+
109+
when "m" #multiplying
110+
puts "Enter two numbers "
111+
x = gets.chomp.to_i
112+
y = gets.chomp.to_i
113+
puts "=" + (x * y).to_s
114+
mainmenu
115+
116+
when "d" #dividing
117+
puts "Enter two numbers "
118+
x = gets.chomp.to_f
119+
y = gets.chomp.to_f
120+
puts "=" + (x / y).to_s
121+
mainmenu
122+
123+
when "p" #power
124+
puts "Enter two numbers "
125+
x = gets.chomp.to_f
126+
y = gets.chomp.to_f
127+
puts "=" + (x ** y).to_s
128+
mainmenu
129+
130+
when "r" #sqaure root
131+
puts "Enter number "
132+
x = gets.chomp.to_f
133+
puts "=" + Math.sqrt(x).to_s
134+
mainmenu
135+
136+
when "g" #mortgage
137+
puts "Enter principle of loan "
138+
p = gets.chomp.to_f
139+
puts "Enter annual interest rate "
140+
i = gets.chomp.to_f / 100 / 12
141+
puts "Enter number of payments"
142+
n = gets.chomp.to_f
143+
puts "=" + m = ( ( (i * ( ( 1 + i ) ** n ) ) / ( ( ( 1 + i ) ** n ) - 1 )) * p ).to_s
144+
mainmenu
145+
146+
when "mi" #bmi
147+
puts "enter height"
148+
ht = gets.chomp.to_f
149+
puts "enter weight"
150+
wt = gets.chomp.to_f
151+
bmi = ( (wt) / ( (ht) * (ht) ) ).to_s #calculating the bmi
152+
puts "your bmi is #{bmi}"
153+
mainmenu
154+
155+
when 't' #trip
156+
puts "enter distance"
157+
d = gets.to_f
158+
puts "how many miles to the gallon? "
159+
mpg = gets.to_f
160+
puts "how much does fuel cost per gallon?"
161+
$pg = gets.to_f
162+
puts "enter speed"
163+
speed = gets.to_f
164+
165+
if speed > 60
166+
for speed in (61..speed) # loop code "For every 1 MPH over 60 MPH, reduce the the MPG by 2 MPG."
167+
mpg -= 2
168+
end
169+
end
170+
171+
time = (d / speed)
172+
cost = (mpg * $pg)
173+
puts "Your trip will take #{ time } hours and cost $#{ cost }."
174+
mainmenu
175+
end
176+
177+
178+
179+
180+
# ,+######:
181+
# `###;:::::::;###`
182+
# :##:::::::::::::::##`
183+
# `#+:::::::::::::::::::##
184+
# ##::::::::::::::::::::::##
185+
# #;::::::::::::::::::::::::;# '##
186+
# #::::::::::::::::::::::::::::# '+##
187+
# #:::::::::::::::::::::::::::::;# +###
188+
# #::::+##+:::::::::::::::;##+::::+# #;:;,
189+
# #:::##. ,#;::::::::::::#' .##:::#. '::::
190+
# ,+::## #;::::::::::## '#:::# .:::+
191+
# #:::#. #:::::::::## #:::++ #::#
192+
# .;::## `'::::::::## #:::# #::+.
193+
# #:::## #:::::::### #:::#' #:::,
194+
# #:::## ###+''##### #::::# ;:::;
195+
# ':::## #;::::::::## #::::#. :::#
196+
# ;::::### #:::::::::::;# #::::#, '::#
197+
# #::::;### #:::::::::::::## ;#::::;' #::#.
198+
# #:':::####'.':::::::::::::::#######:::'::# #::+,
199+
# #:+::::######:::::#####:::::######::::'::# +::;,
200+
# #:+:::::####+::::+#####+:::::####:::::'::# ::::;
201+
# #:'::::::::'::::::#####::::::#::::::::;:;; :::+
202+
# #;'::::::::#::::::':;:;::::::#::::::::;##, :::#
203+
# :#::::::::#:::::;;:::'::::::#::::::::::,` '::#
204+
# #:::::::::#:::::# ;:. ;:::::#:::::::::' +::#`
205+
# #::::::::::#:::::#'#.'##:::::#:::::::::# #::#`
206+
# #:::::::::::#:::::###+++#:::::#:::::::::+# #::#`
207+
# #:::'::::::::#::::##:,;+#+:::::':::::::::#:+ +::#`
208+
# #:::#:::::::::+::::#:+###::':::#::::::::::#::+ '::#`
209+
# #:::##::::::::::#+:#::::::::;+;#:::::::::::#::;+ ;::#`
210+
# #:::';#:::::::::::::::::::::::::::::::::::::#;::;# ::::+
211+
# ';:::',#:::::::::::::::::::::::::::::::::::::##;:::#;.#:::,
212+
# `+:::#, #:::::::::::::::::::::::::::::::::::::#`#:::::::::+,
213+
# #:::#,` #:::::::::::::::::::::::::::::::::::::#` #;:::::::#,
214+
# #:::#,. #:::::::::::::::::::::::::::::::::::::#` '#:::::#,
215+
# ,::::;, #:::::::::::::::::::::::::::::::::::::#` ,##;'#,,
216+
# #:::#, #:::::::::::::::::::::::::::::::::::::#` ,,,,,
217+
# #:::#,` #:::::::::::::::::::::::::::::::::::::#`
218+
# ;:::;, #:::::::::::::::::::::::::::::::::::::#`
219+
# #:::#, #:::::::::::::::::::::::::::::::::::::#`
220+
# :::;,` #:::::::::::::::::::::::::::::::::::::#`
221+
# #:::#, #::::::::::::::::::::::::::::::::::::;+
222+
# #:::,` #::::::::::::::::::::::::::::::::::::''
223+
# +::+, #::::::::::::::::::::::::::::::::::::+:
224+
# +:::+ #::::::::::::::::::::::::::::::::::::#,
225+
# #::::#` :#;:::::::::::::::::::::::::::::::::::#,
226+
# +:::::##: :::#:::::::::::::::::::::::::::::::::::#,
227+
# .#::::::::::#+;::::::::::::::::::::::::::::::::::#,
228+
# .##::::::::'+#::::::::::::::::::::::::::::::::::'`
229+
# ,'##'::::::':::::::::::::::::::::::::::::::::#,
230+
# ,,,:'++::#:::::::::::::::::::::::::::::::::#,
231+
# ``.#+#::::::::::::::::::::::::::::::::#,`
232+
# ,`#:::::::::::::::::::::::::::::::#,
233+
# `#:::::::::::::::::::::::::::::#,
234+
# `#:::::::::::::::::::::::::::#,.
235+
# `+#::::::::::::::::::::::::;,,
236+
# #:::::::::::::::::::::::::'
237+
# #::#+:::::::::::::::;#+:::#
238+
# +:;,,;##+:::::::'###,,,;::#`
239+
# ;:+, .,,:+###+',,,,. +::#.
240+
# .::#, `.,,,.` #::+,
241+
# :::#, #::',
242+
# '::#, #::;:
243+
# #::#. #::;'
244+
# #::#. #:::'
245+
# #::#. #:::'
246+
# #::#. #:::+
247+
# #::#. #:::+
248+
# #::#, #::;'
249+
# #::#, #::;'
250+
# #::#, #::';
251+
# #::#, #::':
252+
# #::+, #::+,
253+
# '::;' #::#,
254+
# ::::# #::#,
255+
# ;::# #::#,
256+
# +::#` +::#,
257+
# #::#. `'::#.
258+
# #::+, :;::#`
259+
# ,#:::+, ':::#+
260+
# .#::::#, `#:::#;
261+
# #::::#,, ##:::#
262+
# #+;##,, ;#+:#,
263+
# ;',,. ,:+;,
264+
# .` `.
265+
#

‎homework/wk1d3/stations.rb

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
3+
lines = {
4+
:n => {'times square' => 1, '34th' => 2, 'n_28th' => 3, 'n_23rd' => 4, 'union square' => 5, '8th' => 6},
5+
:l => {'8th' => 1, '6th' => 2, 'union square' => 3, '3rd' =>4, '1st' => 5},
6+
:l6 => {'grand central' => 1, '33rd' => 2, '6_28th' => 3, '6_23rd' => 4, 'union square' => 5, 'astor place' => 6}
7+
}
8+
9+
p "What line are you on? n, l or l6"
10+
line_menu = gets.chomp
11+
p "what station will you depart from?"
12+
location_og = gets.chomp
13+
p "what line is your destination on? ( n, l, l6)"
14+
dest_line = gets.chomp
15+
p "what station are you going to on this line?"
16+
dest_station = gets.chomp
17+

0 commit comments

Comments
 (0)
Please sign in to comment.