-
Notifications
You must be signed in to change notification settings - Fork 0
/
Profits margin calculator bard edition.html
48 lines (45 loc) · 1.51 KB
/
Profits margin calculator bard edition.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
<html>
<head>
<title>Calculate Total</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css">
<style>
#result {
font-size: 1.2rem;
font-weight: bold;
color: green;
}
.result {
background-color: lightgray;
border: 1px solid black;
padding: 10px;
}
</style>
</head>
<body>
<div class="container">
<h1>Calculate Total</h1>
<form id="calculate-form">
<div class="mb-3">
<label for="initial-number" class="form-label">Enter the initial cost:</label>
<input type="number" class="form-control" id="initial-number" required>
</div>
<button type="submit" class="btn btn-primary">Calculate</button>
</form>
<span class="result" id="result"></span>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js"></script>
<script>
document.getElementById('calculate-form').addEventListener('submit', function(event) {
event.preventDefault();
var initialNumber = parseFloat(document.getElementById('initial-number').value);
var total = calculateTotal(initialNumber);
document.getElementById('result').innerHTML = 'The final total is: ' + total;
});
function calculateTotal(number) {
var total = number * (1 + 0.35);
total = total * (1 + 0.18);
return total;
}
</script>
</body>
</html>