w_5_1 HOF
This commit is contained in:
1402
w5_1_HOF/data.js
Normal file
1402
w5_1_HOF/data.js
Normal file
File diff suppressed because it is too large
Load Diff
49
w5_1_HOF/index.html
Normal file
49
w5_1_HOF/index.html
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<link rel="stylesheet" type="text/css" href="./style.css" />
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<ol class="smallText">
|
||||||
|
<li>
|
||||||
|
<p>Get the list of people with age > 21. How many are there?</p>
|
||||||
|
<p class="result" id="q1">TODO</p>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>Get the total and average income for the entire population.
|
||||||
|
</p>
|
||||||
|
<p class="result" id="q2">TODO</p>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>Get total and average income of people older than 21 (included).</p>
|
||||||
|
<p class="result" id="q3">TODO</p>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>Find in which city “Mitsue Tollner” lives.</p>
|
||||||
|
<p class="result" id="q4">TODO</p>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>Find if there is anyone who lives in the same city of others.</p>
|
||||||
|
<p class="result" id="q5">TODO</p>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>Get the city/cities where most people live.</p>
|
||||||
|
<p class="result" id="q6">TODO</p>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<script defer type="module" src="index.js"></script>
|
||||||
|
<!-- <script defer type="module" src="solution-index.js"></script> -->
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
39
w5_1_HOF/index.js
Normal file
39
w5_1_HOF/index.js
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import data from './data.js';
|
||||||
|
import dataJSON from './data.js'; // this file is a module so we can import
|
||||||
|
console.log(dataJSON);
|
||||||
|
|
||||||
|
// 1. Get the list of people with age > 21. How many are there?
|
||||||
|
const over21 = undefined;
|
||||||
|
// setAnswer(1, over21);
|
||||||
|
|
||||||
|
// 2. Add a universal basic income of 100 but 500 to Andrea
|
||||||
|
const updatedData = undefined;
|
||||||
|
|
||||||
|
// 3. Get the total and average income for the entire population.
|
||||||
|
const totIncome = undefined;
|
||||||
|
const avgIncome = undefined;
|
||||||
|
// setAnswer(2, `Tot income: ${totIncome}, Average income: ${avgIncome}`);
|
||||||
|
|
||||||
|
// 4. Get total and average income of people older than 21 (included).
|
||||||
|
const totIncome21 = undefined;
|
||||||
|
const avgIncome21 = undefined;
|
||||||
|
// setAnswer(3, `Tot income: ${totIncome21}, Average income: ${avgIncome21}`);
|
||||||
|
|
||||||
|
// 5. Find in which city “Mitsue Tollner” lives.
|
||||||
|
const city = undefined;
|
||||||
|
// setAnswer(4, city);
|
||||||
|
|
||||||
|
// 6. Find if there is anyone who lives in the same city of others.
|
||||||
|
const sameCities = undefined;
|
||||||
|
// setAnswer(5, sameCities);
|
||||||
|
|
||||||
|
// 7. Get the city/cities where most people live.
|
||||||
|
const mostPopularCity = undefined;
|
||||||
|
// setAnswer(6, mostPopularCity);
|
||||||
|
|
||||||
|
function setAnswer(n, content) {
|
||||||
|
if (n < 0 || n > 7) return;
|
||||||
|
const el = document.getElementById(`q${n}`);
|
||||||
|
el.innerHTML = content;
|
||||||
|
el.style.color = 'green';
|
||||||
|
}
|
||||||
11
w5_1_HOF/style.css
Normal file
11
w5_1_HOF/style.css
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
body {
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user