-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFolio 1.html
119 lines (106 loc) · 3.63 KB
/
Folio 1.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
112
113
114
115
116
117
118
119
<!DOCTYPE html>
<html>
<head>
<title>Barry's Fishmonger</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Uncomment to use external CSS
<link rel="stylesheet" href="PATH/TO/EXTERNAL/STYLES.CSS">
-->
<style type="text/css">
/* Your CSS goes here */
body {
text-align: center;
}
table {
border: 1px solid black;
text-align: center;
margin-right: auto;
margin-left: auto;
}
</style>
</head>
<body>
<!-- Your HTML goes here -->
<h1>Barry's Fishmonger</h1>
<h5>Maximum 20 kilograms per fish</h5>
<table id="table">
<tr>
<th>Fish Type</th>
<th>Price per Kg</th>
</tr>
<tr>
<td>Barramundi Wild</td>
<td>$9.80</td>
<tr>
<td>Flathead Tails</td>
<td>$10.99</td>
<tr>
<td>Rockling</td>
<td>$9.70</td>
</tr>
<tr>
<td>Snapper Fillets</td>
<td>$9.80</td>
</tr>
<tr>
<td>Gummy Shark (flake)</td>
<td>$8.50</td>
</tr>
</table>
<p>Are you a business customer?</p>
<select id="business">
<option value="0">No</option>
<option value="1">Yes</option>
</select>
<p>Which fish?</p>
<select id="function">
<option></option>
<option value="1">Barramundi Wild</option>
<option value="2">Flathead Tails</option>
<option value="3">Rockling</option>
<option value="4">Snapper Fillets</option>
<option value="5">Gummy Shark (flakes)</option>
</select>
<p>How many kilograms would you like to purchase?</p>
<input type="number" id="kilos" min="0" max="20"><button type="button" onclick="calculate()" id="calculate">Calculate Price</button>
<p>Total Price:</p>
<p id="result"></p>
<!-- Uncomment to use external JavaScript
<script src="PATH/TO/EXTERNAL/SCRIPT.JS"></script>
-->
<script>
/* Your JS goes here */
function calculate() {
// Calculates the end price.
var kilo = document.getElementById("kilos").valueAsNumber;
var e = document.getElementById("function").selectedIndex;
var b = document.getElementById("business").selectedIndex;
var result = 0;
switch (e)
// Determine the fish selected and calculations.
{
case 1:
result = kilo * 9.80;
break;
case 2:
result = kilo * 10.99;
break;
case 3:
result = kilo * 9.70;
break;
case 4:
result = kilo * 9.80;
break;
case 5:
result = kilo * 8.50;
break;
}
if (b == 1) {
// Take 10% off if it's a business customer.
result *= 0.9;
}
document.getElementById("result").innerHTML = "$" + result;
}
</script>
</body>
</html>