-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
47 lines (45 loc) · 1.32 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
<!DOCTYPE html>
<html>
<head>
<title>Taxi Rate Calculator</title>
<style>
.container {
max-width: 400px;
margin: 0 auto;
padding: 20px;
}
.result {
font-weight: bold;
margin-top: 10px;
}
</style>
<script>
function calculateRate() {
var startingPrice = document.getElementById('rateCheckbox').checked ? 8.90 : 6.90;
var ratePerKm = 1.19;
var ratePerMinute = 0.99;
var kilometers = parseFloat(document.getElementById('kilometers').value);
var minutes = parseFloat(document.getElementById('minutes').value);
var totalRate = startingPrice + (ratePerKm * kilometers) + (ratePerMinute * minutes);
document.getElementById('result').textContent = "Total Rate: " + totalRate.toFixed(2) + "€";
}
</script>
</head>
<body>
<div class="container">
<h1>Taxi Rate Calculator</h1>
<label>
<input type="checkbox" id="rateCheckbox"> Pyhä- / yöhinnasto
</label>
<br><br>
<label>Kilometers:</label>
<input type="number" id="kilometers" step="0.01">
<br><br>
<label>Time in minutes:</label>
<input type="number" id="minutes" step="1">
<br><br>
<button onclick="calculateRate()">Calculate</button>
<div class="result" id="result"></div>
</div>
</body>
</html>