-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfinal_exam_calculator.html
71 lines (58 loc) · 1.62 KB
/
final_exam_calculator.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
<!DOCTYPE html>
<html>
<head>
<title>Grade Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
h1 {
text-align: center;
}
label {
display: block;
margin-bottom: 10px;
}
input {
width: 100px;
}
button {
display: block;
margin-top: 10px;
}
#result {
margin-top: 20px;
font-weight: bold;
}
</style>
</head>
<body>
<h1>Grade Calculator</h1>
<div>
<label for="currentGrade">Current Grade (%):</label>
<input type="number" id="currentGrade" min="0" max="100" step="0.01">
</div>
<div>
<label for="examWeight">Exam Weight (%):</label>
<input type="number" id="examWeight" min="0" max="100" step="0.01">
</div>
<div>
<label for="finalExamScore">Final Exam Score (%):</label>
<input type="number" id="finalExamScore" min="0" max="100" step="0.01">
</div>
<button onclick="calculateGrade()">Calculate</button>
<div id="result"></div>
<script>
function calculateGrade() {
var currentGrade = parseFloat(document.getElementById("currentGrade").value);
var examWeight = parseFloat(document.getElementById("examWeight").value);
var finalExamScore = parseFloat(document.getElementById("finalExamScore").value);
// Calculate the final grade
var finalGrade = (currentGrade * (100 - examWeight) / 100) + (finalExamScore * examWeight / 100);
// Display the result
document.getElementById("result").textContent = "Final Grade: " + finalGrade.toFixed(2) + "%";
}
</script>
</body>
</html>