forked from donalus/INST377
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoundtree_JavaScript_assignment1_resubmit
More file actions
282 lines (274 loc) · 9.61 KB
/
Copy pathRoundtree_JavaScript_assignment1_resubmit
File metadata and controls
282 lines (274 loc) · 9.61 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
<html>
<head>
<!-- CSS -->
<style>
table {
border-collapse: collapse;
width: 100%;
}
th, td {
padding: 8px;
text-align: left;
border-bottom: 1px solid #ddd; <!-- CSS tabel styling -->
}
tr:hover {background-color:#f5f5f5;}
</style>
<!-- Data -->
<script>
// Don't copy this to any other places in this file. You can just use the "organizations" variable to do your assignment.
var organizations = [
{
"Region": "East Asia & Pacific",
"Country": "New Zealand",
"Country Income Level": "High income",
"Organization Name": "200 Square",
"Organization Type": "For-profit",
"Sectors": "Housing, construction & real estate",
"Description": "200 Square is an online real estate agent in New Zealand.",
"City": "Wellington",
"State/Region": "Wellington",
"Founding Year": 2010,
"Size": "1 to 10",
"Type of Data Used": "Housing, Education",
"profileID": "731"
},
{
"Region": "Europe & Central Asia",
"Country": "United Kingdom",
"Country Income Level": "High income",
"Organization Name": "21c Consultancy",
"Organization Type": "For-profit",
"Sectors": "IT and geospatial",
"Description": "21c is ICT innovation consultancy which advises international actors, institutions and governments around the world on technological trends which can affect the way they deliver services.",
"City": "London",
"State/Region": "",
"Founding Year": 2015,
"Size": "1 to 10",
"Type of Data Used": "",
"profileID": "1694"
},
{
"Region": "Europe & Central Asia",
"Country": "Russian Federation",
"Country Income Level": "High income",
"Organization Name": "2GIS",
"Organization Type": "For-profit",
"Sectors": "IT and geospatial",
"Description": "2GIS is a city information service combined with a map. ",
"City": "Novosibirsk",
"State/Region": "Novosibirsk Oblast",
"Founding Year": 1999,
"Size": "1000+",
"Type of Data Used": "Transportation, Geospatial, Business",
"profileID": "1025"
},
{
"Region": "North America",
"Country": "United States",
"Country Income Level": "High income",
"Organization Name": "2nd City Zoning",
"Organization Type": "Nonprofit",
"Sectors": "Housing, construction & real estate",
"Description": "An Open City App, 2nd City Zoning is an interactive map that lets you find out how your building is zoned, learn where to locate your business and explore zoning patterns throughout the city.",
"City": "Chicago",
"State/Region": "Illinois",
"Founding Year": 2013,
"Size": "1 to 10",
"Type of Data Used": "Housing",
"profileID": "1693"
},
{
"Region": "North America",
"Country": "United States",
"Country Income Level": "High income",
"Organization Name": "3 Round Stones Inc",
"Organization Type": "For-profit",
"Sectors": "IT and geospatial",
"Description": "3 Round Stones' Open Source platform is used by the Fortune 2000 and US Government Agencies to collect, publish and reuse data, both public and proprietary.",
"City": "Arlington",
"State/Region": "Virginia",
"Founding Year": 2010,
"Size": "1 to 10",
"Type of Data Used": "Weather, Science and research, Health/healthcare, Geospatial, Environment, Energy, Demographic and social, Business",
"profileID": "580"
},
{
"Region": "North America",
"Country": "United States",
"Country Income Level": "High income",
"Organization Name": "360 Yield Center",
"Organization Type": "For-profit",
"Sectors": "Agriculture",
"Description": "Taking a 360-degree view of key yield-limiting variables, 360 Yield Center develops strategies for better-performing crops and better on-farm profits.",
"City": "Morton",
"State/Region": "Illinois",
"Founding Year": 2014,
"Size": "51 to 200",
"Type of Data Used": "Agriculture, Environment, Weather",
"profileID": "1692"
},
{
"Region": "Europe & Central Asia",
"Country": "Denmark",
"Country Income Level": "High income",
"Organization Name": "3Strikes - City Stories",
"Organization Type": "For-profit",
"Sectors": "Arts, culture and tourism",
"Description": "City Stories provides a platform that allows users to explore local stories and simultaneously contribute their own.",
"City": "Aarhus",
"State/Region": "Central Denmark Region",
"Founding Year": 2015,
"Size": "1 to 10",
"Type of Data Used": "Arts and culture",
"profileID": "2278"
},
{
"Region": "Europe & Central Asia",
"Country": "Finland",
"Country Income Level": "High income",
"Organization Name": "3Tier (Europe) ",
"Organization Type": "For-profit",
"Sectors": "Energy and climate",
"Description": "3TIER is a global environmental and industrial measurement company providing weather-driven renewable energy risk assessment and forecasting for wind, solar, and hydro power projects.",
"City": "Helsinki",
"State/Region": "Uusimaa",
"Founding Year": 2012,
"Size": "11 to 50",
"Type of Data Used": "Other, Environment",
"profileID": "952"
},
{
"Region": "North America",
"Country": "United States",
"Country Income Level": "High income",
"Organization Name": "5PSolutions",
"Organization Type": "For-profit",
"Sectors": "IT and geospatial",
"Description": "5PSolutions are artisans of mobile platforms.",
"City": "Fairfax",
"State/Region": "Virginia",
"Founding Year": 2007,
"Size": "1 to 10",
"Type of Data Used": "Environment",
"profileID": "534"
},
{
"Region": "North America",
"Country": "United States",
"Country Income Level": "High income",
"Organization Name": "AAA National",
"Organization Type": "Other",
"Sectors": "Transportation and logistics",
"Description": "AAA provides services such as travel, automotive, insurance, financial, and discounts.",
"City": "Irving",
"State/Region": "Texas",
"Founding Year": 1902,
"Size": "201 to 1000",
"Type of Data Used": "Transportation",
"profileID": "1691"
},
{
"Region": "North America",
"Country": "United States",
"Country Income Level": "High income",
"Organization Name": "AAASHTO",
"Organization Type": "Other",
"Sectors": "Transportation and logistics",
"Description": "AASHTO works to educate the public and key decision makers about the critical role that transportation plays in securing a good quality of life and sound economy. AASHTO serves as a liaison between state departments of transportation and the Federal government.",
"City": "Washington",
"State/Region": "DC",
"Founding Year": 1913,
"Size": "51 to 200",
"Type of Data Used": "Transportation",
"profileID": "1690"
},
{
"Region": "Latin America & Caribbean",
"Country": "Chile",
"Country Income Level": "High income",
"Organization Name": "ABRELATAM",
"Organization Type": "Nonprofit",
"Sectors": "Governance",
"Description": "ABRELATAM is an conference that seeks to accelerate the process of opening information through Open Data transparency and promote the Latin America.",
"City": "Santiago",
"State/Region": "",
"Founding Year": 2015,
"Size": "",
"Type of Data Used": "",
"profileID": "1687"
}
];
</script>
</head>
<body>
<!-- Feel free to add empty tags. Data shouldn't be here. -->
<div id="org_table"></div>
<table id="org_table"> <!-- Table tag & id -->
<tr> <!-- Table row -->
<th>Questions</th> <!-- Table header -->
<th>Answers</th>
</tr>
<tr>
<td>How many non-profit organizations are listed?</td> <!-- Table data -->
<td id="non_prof"</td>
</tr>
<tr>
<td>How many organizations are less than 10 years old?</td>
<td id="age"</td>
</tr>
<tr>
<td> How many of these organizations are North American?</td>
<td id="continent"</td>
</tr>
<tr>
<td>How many organizations used the Transportation type of data?</td>
<td id="data_type"</td>
</tr>
<tr>
<td>How many organizations are part of the IT sector? </td>
<td id="sector"</td>
</tr>
</table>
<script>
console.log("test");
// Your JavaScript code goes here
var answer1 = 0;
var answer2 = 0;
var answer3 = 0;
var answer4 = 0;
var answer5 = 0;
var date = new Date();
var currentYear = date.getFullYear();
i =0;
while( i<organizations.length)
{
if(organizations[i]["Organization Type"]=="Nonprofit")
{
answer1++;
}
if(currentYear - organizations[i]["Founding Year"] < 10 )
{
answer2++;
}
if( organizations[i]["Region"] == "North America" )
{
answer3++;
}
if( organizations[i]["Type of Data Used"].includes("Transportation") )
{
answer4++;
}
if( organizations[i]["Sectors"].includes("IT") )
{
answer5++;
}
i++;
}
document.getElementById("non_prof").innerHTML = answer1;
document.getElementById("age").innerHTML = answer2;
document.getElementById("continent").innerHTML = answer3;
document.getElementById("data_type").innerHTML = answer4;
document.getElementById("sector").innerHTML = answer5;
</script>
</body>
</html>