-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathabstraction.html
More file actions
55 lines (52 loc) · 2.45 KB
/
abstraction.html
File metadata and controls
55 lines (52 loc) · 2.45 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="/assets/favicon.png">
<title>Abstraction</title>
<style>
img {
padding: 0px;
margin: 0px;
border: 0px;
}
img:hover {
cursor: pointer;
}
</style>
<link rel="stylesheet" href="style.css">
<body>
<div class="container">
<h1>abstraction</h1>
<div class="body-container">
<div style="width: 100%; display: inline-block; text-align: center"><img id="average" src="assets/average46.png" width="267px" height="200px" onclick="changeImage()"></div>
<p>This is a calculation we could use to find the <strong>average</strong> of 4 and 6. But what if we want to perform this calculation for <strong>any number</strong>?</p>
<p id="anynumbers" style="visibility:hidden">Great! Now, we can compute the average of any numbers we give this function! But what if we want to average things that are <strong>not numbers</strong>?</p>
<p id="otherthings" style="visibility:hidden">Think about it: How would you decide to compute the average of two <strong>words</strong>? Or two <strong>groups of numbers</strong>? Being able to use the <strong>same</strong> calculation in <strong>different</strong> ways is part of an important concept in Computer Science called <strong>abstraction</strong>.</p>
<p id="betaMsg"><i>(Click on the image to advance the module)</i></p>
</div>
<div class="next-button" onclick="window.location.href='computationalthinking.html'">
<div class="button-text">< back to computational thinking</div>
</div>
</div>
</body>
<script>
var numClick = 0;
function changeImage() {
var imageElement = document.getElementById('average');
var anyNumbers = document.getElementById('anynumbers');
var otherThings = document.getElementById('otherthings');
var betaMsg = document.getElementById('betaMsg');
if (numClick == 0) {
numClick += 1;
imageElement.src = 'assets/averagexy.png';
anyNumbers.style.visibility = 'visible';
} else {
imageElement.src = 'assets/averageAB.png';
otherThings.style.visibility = 'visible';
betaMsg.innerHTML = "<i>(Section completed.)</i>";
}
}
</script>
</html>