-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
111 lines (108 loc) · 4.36 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta content="width=device-width, initial-scale=1" name="viewport" />
<title>Temperature Converter</title>
<link rel="stylesheet" href="../taskCommonStyles.css" />
<!-- GUI ------------------------------------------------- -->
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<header>
<nav>
<a href="../">Back</a>
</nav>
<h1>Temperature Converter (for Chingu Roundtable)</h1>
<p>Based on Brad Woods 7Guis Project</p>
<div id="line">
===================================================================================================================================================================
</div>
</header>
<section id="description">
<h2>Challenge:</h2>
<p>Bidirectional data flow, user-provided text input.</p>
<h2>Criteria:</h2>
<ul id="criteria">
<li>
The task is to build a frame containing 2 textfields representing the temperature in Celsius and Fahrenheit.
</li>
<li>Initially, both textfields are empty.</li>
<li>
When the user enters a numerical value into a textfield, the corresponding value in the other is automatically
updated.
</li>
<li>When the user enters a non-numerical string into a textfield, the value in the other is not updated.</li>
<li>Formula for converting a temperature from Celsius to Fahrenheit: F = C * (9/5) + 32</li>
<li>Formula for converting a temperature from Fahrenheit to Celsius: C = (F - 32) * (5/9)</li>
</ul>
<p>
Temperature Converter increases the complexity of Counter by having bidirectional data flow between the Celsius
and Fahrenheit inputs and the need to check the user input for validity. A good solution will make the
bidirectional dependency very clear with minimal boilerplate code.
</p>
<p>
Temperature Converter is inspired by the
<a href="https://www.artima.com/pins1ed/gui-programming.html#32.4" target="_blank" rel="noopener noreferrer"
>Celsius/Fahrenheit converter</a
>
from the book Programming in Scala. It is such a widespread example—sometimes also in the form of a currency
converter—that one could give a thousand references. The same is true for the Counter task.
</p>
<img alt="A dialogue box with 2 inputs with label celsius & fahrenheit." src="/images/temperatureConverter.png" />
</section>
<section id="gui">
<!-- GUI ------------------------------------------------- -->
<form id="tempConverter">
<h1>Temperature Converter</h1>
<div class="row">
<input id="celsius" oninput="onCelsiusInput(event)" step=".01" type="number" autofocus />
<label for="celsius">CELCIUS</label> =
<input id="fahrenheit" oninput="onFahrenheitInput(event)" step=".01" type="number" />
<label for="fahrenheit">FAHRENHEIT</label>
</div>
</form>
<section id="assumptions">
<h2>Assumptions:</h2>
<ul>
<li>Temperature accuracy is to 2 decimal points.</li>
</ul>
</section>
<section id="code">
<h2>Code:</h2>
<p>
After opening a code link below, hit the '.' key to open GitHub's browser editor for improved reading
experience.
</p>
<ul>
<li>
<a
href="https://github.com/bradwoods/7-guis-html-css-js/blob/main/docs/temperature-converter/index.html"
target="_blank"
rel="noopener noreferrer"
>HTML</a
>
</li>
<li>
<a
href="https://github.com/bradwoods/7-guis-html-css-js/blob/main/docs/temperature-converter/styles.css"
target="_blank"
rel="noopener noreferrer"
>CSS</a
>
</li>
<li>
<a
href="https://github.com/bradwoods/7-guis-html-css-js/blob/main/docs/temperature-converter/index.js"
target="_blank"
rel="noopener noreferrer"
>JS</a
>
</li>
</ul>
</section>
</section>
<!-- GUI ------------------------------------------------- -->
<script src="index.js" defer></script>
</body>
</html>