-
Notifications
You must be signed in to change notification settings - Fork 0
/
semester2.html
154 lines (136 loc) · 5.47 KB
/
semester2.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Score Analyzer</title>
<style>
body {
font-family:'Courier Prime', monospace;
background-color: #1a1a1a; /* Dark background */
color: #f0f4f8; /* Light text color */
padding: 20px;
text-align: center;
}
.container {
max-width: 500px;
margin: 0 auto;
background-color: #333; /* Darker container */
padding: 30px;
border-radius: 10px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}
h1, h3, p {
color: #f0f4f8; /* Light text color */
}
select, input[type="number"], button {
width: 100%;
padding: 12px;
margin: 10px 0;
border-radius: 5px;
border: 1px solid #444; /* Darker border */
font-size: 16px;
box-sizing: border-box;
background-color: #555; /* Dark input background */
color: #f0f4f8; /* Light text color */
}
button {
background-color: #4CAF50;
color: white;
cursor: pointer;
transition: background-color 0.3s;
}
.note {
color: #ababab;
margin: 10px 0; /* Spacing above and below */
font-size: 14px; /* Slightly smaller font */
}
button:hover {
background-color: #45a049;
}
h3 {
margin-top: 20px;
}
</style>
</head>
<body onload="showFields()">
<div class="container">
<h1>Score Analyzer</h1>
<p>Select Subject:</p>
<select id="subject" onchange="showFields()">
<option value="3">Mechanical Engineering Sciences</option>
<option value="4">Elements of Electrical Engineering</option>
<option value="5">Engineering Mathematics - II</option>
<option value="1">Engineering Physics</option>
<option value="2">Problem Solving With C</option>
</select>
<div id="inputs"></div>
<button onclick="calculateGrade()">Calculate Grade</button>
<h3 id="result"></h3>
<p class="note"><strong>Note:</strong> Calculations are based on absolute grading.</p>
</div>
<script>
function showFields() {
const subject = document.getElementById("subject").value;
const inputs = document.getElementById("inputs");
inputs.innerHTML = ""; // Clear previous inputs
// Show input fields based on selected subject
if (subject == 4 || subject == 5 || subject ==3) { // AFLL and MATH
inputs.innerHTML = `
<input type="number" id="i1" placeholder="ISA 1 Marks" required>
<input type="number" id="i2" placeholder="ISA 2 Marks" required>
<input type="number" id="a1" placeholder="Assignment Marks (/10)" required>
<input type="number" id="e1" placeholder="ESA Marks" required>
`;
} else if (subject == 1 || subject == 2) { // DDCO and DSA
inputs.innerHTML = `
<input type="number" id="i1" placeholder="ISA 1 Marks" required>
<input type="number" id="i2" placeholder="ISA 2 Marks" required>
<input type="number" id="a1" placeholder="Assignment Marks (/10)" required>
<input type="number" id="e1" placeholder="ESA Marks" required>
<input type="number" id="lab" placeholder="Lab Marks (/20)" required>
`;
}
}
function calculateGrade() {
const subject = document.getElementById("subject").value;
let result = 0;
if (subject == 4 || subject == 5) { // AFLL and MATH
const i1 = parseInt(document.getElementById("i1").value) || 0;
const i2 = parseInt(document.getElementById("i2").value) || 0;
const a1 = parseInt(document.getElementById("a1").value) || 0;
const e1 = parseInt(document.getElementById("e1").value) || 0;
result = Math.ceil(i1 / 2) + Math.ceil(i2 / 2) + a1 + Math.ceil(e1 / 2);
} else if (subject == 1 || subject == 2) { // DSA and DDCO
const i1 = parseInt(document.getElementById("i1").value) || 0;
const i2 = parseInt(document.getElementById("i2").value) || 0;
const a1 = parseInt(document.getElementById("a1").value) || 0;
const e1 = parseInt(document.getElementById("e1").value) || 0;
const lab = parseInt(document.getElementById("lab").value) || 0;
result = Math.ceil(i1 / 2) + Math.ceil(i2 / 2) + a1 + Math.ceil(e1 / 2) + Math.ceil(lab);
result = Math.floor((result * 100) / 120); // Scaling down to /100
}
// Ensure the result does not exceed 100
result = Math.min(result, 100);
// Determine grade based on the result
let grade = '';
if (result >= 90) {
grade = 'S';
} else if (result >= 80) {
grade = 'A';
} else if (result >= 70) {
grade = 'B';
} else if (result >= 60) {
grade = 'C';
} else if (result >= 50) {
grade = 'D';
} else if (result >= 40) {
grade = 'E';
} else {
grade = 'F';
}
document.getElementById("result").innerHTML = `Marks Obtained: ${result} / 100<br>Grade Obtained: ${grade}`;
}
</script>
</body>
</html>