diff --git a/generate_weather_page.rb b/generate_weather_page.rb
index cb89076..c5dd829 100644
--- a/generate_weather_page.rb
+++ b/generate_weather_page.rb
@@ -1,4 +1,9 @@
-require './weather_api'
+# 1. Can you figure out how this program currently works?
+# (Run this program and save the results into a file named weather.html.)
+#
+# 2. Can you fix it so that we can see the weather for all three cities?
+
+require './weather_api.rb'
def start_of_page
html = '
@@ -20,24 +25,24 @@ def end_of_page
return final_part
end
-
-def html_for_city(city_name, image)
- coordinates = get_coordinates(city_name)
- current_temp = get_current_temperature(coordinates.first, coordinates.last)
- html = '
'
- html << "
#{city_name}
"
- html << '
' + current_temp.to_s + '° F
'
+def html_for_city(city_name, current_temp, image)
+ html_fragment = '
'
+ html_fragment << "
#{city_name}
"
+ html_fragment << "
#{current_temp}° F
"
if image != nil
- html << "

"
+ html_fragment << "

"
end
- html << "
"
- return html
+ html_fragment << "
"
+ return html_fragment
end
puts start_of_page
-puts html_for_city("Chicago",'http://upload.wikimedia.org/wikipedia/commons/thumb/e/e8/20090524_Buildings_along_Chicago_River_line_the_south_border_of_the_Near_North_Side_and_Streeterville_and_the_north_border_of_Chicago_Loop%2C_Lakeshore_East_and_Illinois_Center.jpg/800px-thumbnail.jpg')
-puts html_for_city("Los Angeles", 'http://upload.wikimedia.org/wikipedia/commons/thumb/d/d0/Macarthur_Park.jpg/800px-Macarthur_Park.jpg')
-puts html_for_city("Anchorage", 'http://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Anchorage_on_an_April_evening.jpg/800px-Anchorage_on_an_April_evening.jpg')
+
+puts html_for_city("Chicago", get_current_temperature(get_coordinates("Chicago").first, get_coordinates("Chicago").last), 'http://upload.wikimedia.org/wikipedia/commons/thumb/e/e8/20090524_Buildings_along_Chicago_River_line_the_south_border_of_the_Near_North_Side_and_Streeterville_and_the_north_border_of_Chicago_Loop%2C_Lakeshore_East_and_Illinois_Center.jpg/800px-thumbnail.jpg')
+
+
+puts html_for_city("Los Angeles", get_current_temperature(get_coordinates("Los Angeles").first, get_coordinates("Chicago").last), 'http://upload.wikimedia.org/wikipedia/commons/thumb/d/d0/Macarthur_Park.jpg/800px-Macarthur_Park.jpg')
+puts html_for_city("Anchorage", get_current_temperature(get_coordinates("Anchorage").first, get_coordinates("Chicago").last), 'http://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Anchorage_on_an_April_evening.jpg/800px-Anchorage_on_an_April_evening.jpg')
puts end_of_page
diff --git a/json_weather b/json_weather
new file mode 100644
index 0000000..8dfa95a
--- /dev/null
+++ b/json_weather
@@ -0,0 +1 @@
+weather fork