-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstudent.js
38 lines (32 loc) · 908 Bytes
/
student.js
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
function getResult() {
let h, c, j, tot, avg, grd;
// call data from user interface
h = parseInt(hm.value);
c = parseInt(cm.value);
j = parseInt(jm.value);
tot = h + c + j;
avg = tot / 3;
if (h >= 40 && c >= 40 && j >= 40) {
if (avg >= 80)
grd = "A+";
else if (avg >= 70)
grd = "A";
else if (avg >= 60)
grd = "B+";
else if (avg >= 50)
grd = "B";
else
grd = "D";
}
else {
grd = "Fail";
}
// alert(tot)
// total.value = "Total Marks:" +tot;
// average.value = "Average:" +avg;
// CanvasGradient.value = "Grade :"+grd;
// DOM
document.getElementById('total').innerHTML = "Total Marks:" + tot;
document.getElementById('average').innerHTML = "Average: " + avg;
document.getElementById('grade').innerHTML = "Grade:" + grd;
}